473,414 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

How can I make my datacolumn contains an array instead of a single value??

Is it a possibel to assign an array to a DataColumn then bind it to a Combo
box??
Is the follwoing code right?
public static DataSet InsertParamsToDS(ReportParameter[] arrParams)
{

DataSet RepDS=new DataSet();
DataTable objDataTable=new DataTable("ReportParams");
RepDS.Tables.Add(objDataTable);
objDataTable.Columns.Add("Name",typeof(string));
objDataTable.Columns.Add("ValidValues",typeof(Vali dValue[]));

foreach(ReportParameter repParam in arrParams)
{
DataRow objDR=objDataTable.NewRow();
objDR ["Name"]=repParam.Name;

/**** I want in my Datagrid instead textbox for ValidValues a
combobox holds the values of "repParam.ValidValues"*//////
objDR ["ValidValues"]=repParam.ValidValues;

objDataTable.Rows.Add(objDR);
}

return RepDS;

}
Nov 16 '05 #1
4 4420
ALI-R,

The only SQL data type that would support an array is a binary type,
which will return to you an array of bytes. Other than that, no you can not
do this, as array types are not supported by the DataSet (at least, as
column types, nor are they supported by most databases).

If anything, create another table that you can create a relation to
where every row would be an entry in your array (where the key in the parent
table indicates which rows from the child table to use).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:uV**************@TK2MSFTNGP15.phx.gbl...
Is it a possibel to assign an array to a DataColumn then bind it to a
Combo
box??
Is the follwoing code right?
public static DataSet InsertParamsToDS(ReportParameter[] arrParams)
{

DataSet RepDS=new DataSet();
DataTable objDataTable=new DataTable("ReportParams");
RepDS.Tables.Add(objDataTable);
objDataTable.Columns.Add("Name",typeof(string));
objDataTable.Columns.Add("ValidValues",typeof(Vali dValue[]));

foreach(ReportParameter repParam in arrParams)
{
DataRow objDR=objDataTable.NewRow();
objDR ["Name"]=repParam.Name;

/**** I want in my Datagrid instead textbox for ValidValues a
combobox holds the values of "repParam.ValidValues"*//////
objDR ["ValidValues"]=repParam.ValidValues;

objDataTable.Rows.Add(objDR);
}

return RepDS;

}

Nov 16 '05 #2
Thanks for your help,,

my problem is that for each row there is a differnet child table because
each row has its own array ,how can I create dynamic childTables and bind
them to the parent table??

I am so dissappointed!:-)
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
ALI-R,

The only SQL data type that would support an array is a binary type,
which will return to you an array of bytes. Other than that, no you can not do this, as array types are not supported by the DataSet (at least, as
column types, nor are they supported by most databases).

If anything, create another table that you can create a relation to
where every row would be an entry in your array (where the key in the parent table indicates which rows from the child table to use).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:uV**************@TK2MSFTNGP15.phx.gbl...
Is it a possibel to assign an array to a DataColumn then bind it to a
Combo
box??
Is the follwoing code right?
public static DataSet InsertParamsToDS(ReportParameter[] arrParams)
{

DataSet RepDS=new DataSet();
DataTable objDataTable=new DataTable("ReportParams");
RepDS.Tables.Add(objDataTable);
objDataTable.Columns.Add("Name",typeof(string));
objDataTable.Columns.Add("ValidValues",typeof(Vali dValue[]));

foreach(ReportParameter repParam in arrParams)
{
DataRow objDR=objDataTable.NewRow();
objDR ["Name"]=repParam.Name;

/**** I want in my Datagrid instead textbox for ValidValues a
combobox holds the values of "repParam.ValidValues"*//////
objDR ["ValidValues"]=repParam.ValidValues;

objDataTable.Rows.Add(objDR);
}

return RepDS;

}


Nov 16 '05 #3
ALI-R,

You can just create a new instance of the data table and add it through
the Add method on the DataTablesCollection returned from the Tables
property.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Thanks for your help,,

my problem is that for each row there is a differnet child table because
each row has its own array ,how can I create dynamic childTables and bind
them to the parent table??

I am so dissappointed!:-)
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
ALI-R,

The only SQL data type that would support an array is a binary type,
which will return to you an array of bytes. Other than that, no you can

not
do this, as array types are not supported by the DataSet (at least, as
column types, nor are they supported by most databases).

If anything, create another table that you can create a relation to
where every row would be an entry in your array (where the key in the

parent
table indicates which rows from the child table to use).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:uV**************@TK2MSFTNGP15.phx.gbl...
> Is it a possibel to assign an array to a DataColumn then bind it to a
> Combo
> box??
> Is the follwoing code right?
>
>
> public static DataSet InsertParamsToDS(ReportParameter[] arrParams)
> {
>
> DataSet RepDS=new DataSet();
> DataTable objDataTable=new DataTable("ReportParams");
> RepDS.Tables.Add(objDataTable);
> objDataTable.Columns.Add("Name",typeof(string));
> objDataTable.Columns.Add("ValidValues",typeof(Vali dValue[]));
>
> foreach(ReportParameter repParam in arrParams)
> {
> DataRow objDR=objDataTable.NewRow();
> objDR ["Name"]=repParam.Name;
>
> /**** I want in my Datagrid instead textbox for ValidValues a
> combobox holds the values of "repParam.ValidValues"*//////
> objDR ["ValidValues"]=repParam.ValidValues;
>
> objDataTable.Rows.Add(objDR);
> }
>
> return RepDS;
>
> }
>
>



Nov 16 '05 #4
Let me explain my problem,,
I am trying to connect to a report on the reporting service and extracting
all its parameters and their values(which are based on the query) and let
the user edit those paramters value and submit the report,my ONLY problem is
that how to show these params ,I am using a datagrid ,but I am stuck because
each row which represents a paramater has differnt set of values!!!! and I
can't show them.

Do you have any suggestions how to do that??

I aapriciate your help.
ALI
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:O7****************@TK2MSFTNGP12.phx.gbl...
ALI-R,

You can just create a new instance of the data table and add it through the Add method on the DataTablesCollection returned from the Tables
property.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Thanks for your help,,

my problem is that for each row there is a differnet child table because
each row has its own array ,how can I create dynamic childTables and bind them to the parent table??

I am so dissappointed!:-)
Thanks
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
ALI-R,

The only SQL data type that would support an array is a binary type, which will return to you an array of bytes. Other than that, no you
can not
do this, as array types are not supported by the DataSet (at least, as
column types, nor are they supported by most databases).

If anything, create another table that you can create a relation to
where every row would be an entry in your array (where the key in the

parent
table indicates which rows from the child table to use).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"ALI-R" <ne****@microsoft.com> wrote in message
news:uV**************@TK2MSFTNGP15.phx.gbl...
> Is it a possibel to assign an array to a DataColumn then bind it to a
> Combo
> box??
> Is the follwoing code right?
>
>
> public static DataSet InsertParamsToDS(ReportParameter[] arrParams)
> {
>
> DataSet RepDS=new DataSet();
> DataTable objDataTable=new DataTable("ReportParams");
> RepDS.Tables.Add(objDataTable);
> objDataTable.Columns.Add("Name",typeof(string));
> objDataTable.Columns.Add("ValidValues",typeof(Vali dValue[]));
>
> foreach(ReportParameter repParam in arrParams)
> {
> DataRow objDR=objDataTable.NewRow();
> objDR ["Name"]=repParam.Name;
>
> /**** I want in my Datagrid instead textbox for ValidValues a
> combobox holds the values of "repParam.ValidValues"*//////
> objDR ["ValidValues"]=repParam.ValidValues;
>
> objDataTable.Rows.Add(objDR);
> }
>
> return RepDS;
>
> }
>
>



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brett | last post by:
I often have to change a single value in an xml file based off of a given ID. Is there any easy way to do this through .net.xml? Do I have to parse the file then write it out again?
8
by: Tom | last post by:
Here is what I do to get a single value from my database (using Oracle ODP as example): Dim ID as Object Dim cmdTest as New OracleCommand("select ID from MyTable where key = " & KeySearch")...
3
by: Bill Nguyen | last post by:
VS.NET 2003 SQLserver 2000 I need to create a function to return the single resulting value from an SQL statement. For example, "Select max(amount) from tableA" I would like to reuse the...
4
by: Jim in Arizona | last post by:
I'm having trouble pulling a single value from my SQL DB and filling a string type with it. Something like: Dim strConnection As String =...
7
by: Peter | last post by:
Gday, I have a dataset with multiple tables, from which I want to access a single value in one of those tables. I know I can do something like: Decimal myVar =...
1
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
Is it possible to compare a single value to many in a single statement? Here is what I am attempting to do: 1. Users lands on page and via a cookie check function they are identified. 2. A query...
3
by: bogdan | last post by:
Hi, I have a stored procedure that returns a single value. Example: SELECT @RowCount = COUNT(*) FROM t WHERE RETURN @RowCount I created a data set, table adapter, and adapter's method...
4
by: akshay01 | last post by:
Hi All, I am using the following code in which i am creating some textboxes and and as the for loop continues the name of the textboxes will also be unique for all the textboxes. now i want to...
1
by: psycho | last post by:
How do we return a single value from a stored procedure. Suppose I have a stored procedure like this: create proc dbo.spInsertGroup @ID uniqueidentifier @GroupName varchar(100), @IsActive...
19
by: jaad | last post by:
how do you reference a single value field to a multi-value field? I sometime use a macro in form1 to open form 2 containing the same ID example: Open form: WorkOrder where condition: ="="...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.