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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 11/15/04


Date: Mon, 15 Nov 2004 15:20:14 -0500

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]
               - mvp@spam.guard.caspershouse.com
"ALI-R" <newbie@microsoft.com> wrote in message 
news:uVlH270yEHA.3808@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(ValidValue[]));
>
>    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;
>
>  }
>
> 


Relevant Pages