Hi
I am using the SqlCommand/DataAdapter/DataSet to read some records from a table. I then put the results into some text boxes. I am using Rows, and ItemArray :
But is there a way of accessing the DataSet by the table field names ? Like:
Obviously this does not work, but is there a way to do it like this?
SD
I am using the SqlCommand/DataAdapter/DataSet to read some records from a table. I then put the results into some text boxes. I am using Rows, and ItemArray :
Code:
txtEventID.Text=oDS.Tables["Events"].Rows[x].ItemArray[0].ToString();
txtEventName.Text=oDS.Tables["Events"].Rows[x].ItemArray[4].ToString();
txtCode.Text=oDS.Tables["Events"].Rows[x].ItemArray[5].ToString();
Code:
txtEventID.Text=oDS.Tables["Events"].Rows[x].[b]ItemArray["ID"][/b].ToString();
txtEventName.Text=oDS.Tables["Events"].Rows[x].[b]ItemArray["Name"][/b].ToString();
txtCode.Text=oDS.Tables["Events"].Rows[x].[b]ItemArray["Code"][/b].ToString();
SD