Reading from DB

How to I read multiple rows from a database without having to bind them to a control I need to be able to later add them to an array.

Thanks,



Answer this question

Reading from DB

  • bkitduy

    Thank you, I will try this later today. I am happy to see a forum where responses are fast and accurate. Keep up the good work guys (and gals).
  • ANAX

    hi,

    i don't know if you mean database or dataset , you can put them in array in one step

    DataRow[] dr = mydataset.table1.Rows.Find("columnName = value);

    this will make the array of rows you can read the data by iterate through rows

    foreach(datarow singlerow in dr)

    variable = dr("column1Name")

    variable2 dr("column2Name")

    hope this helps



  • programmer 2006

    int j = ds.Tables["TableName"].Rows.Count;

    for(int i = 0; i < j; i++)

    {

    // process ds.Tables["TableName"].Rows [ i ] which represents the data row

    }



  • Catalin Stavaru

    Well, I've done that much already. I cannot seem to go to the next row after reading the first row. how do I move between rows should be my original question, sorry.


  • James Christian

    use a dataset to capture the rows from a database.



  • Reading from DB