2
Reply

jagged arrays

wim de moor

wim de moor

Jan 2 2008 6:37 PM
2.9k

hello, ik would like to use a jagged array to send data that was filled in a listview
this data i get from a database

my code so far is

public static object[][] zoekiets(string sql)
{
int rij;
int col;

SqlDB Zeilen = new SqlDB();
Zeilen.fillDataset("tblZoekiets", sql, true);
int aantal_columns = Zeilen.DS.Tables["tblZoekiets"].Columns.Count;
int aantal_rows = Zeilen.DS.Tables["tblZoekiets"].Rows.Count;

object[][] zoeklijst = new object[1][];
rij = 0;

foreach (DataRow dr in Zeilen.DS.Tables["tblZoekiets"].Rows)
{
   for (int teller = 0; teller < aantal_columns; teller++)
   {
   zoeklijst[rij][teller] = new Type(dr[teller].GetType); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   }
   rij++;
}

the thing is that the type of data is always different depending on the sql that comes with it
where i put the !!!!!!!!!!!!! it goes wrong
i have to declare the type for every column but how do i do that


Answers (2)