DataSet, DataRows etc.
-
Hi! I'm trying to print the values in my DataSet. It has a single row in it. I used this CommandText: "Select NAME from Authors" Now the query returns all the names. Now, I want to print the values in the dataset and I want to use foreach because I do not know how many names I might get. But the problem is, what do I use to traverse my set? I used this ff code but it generates an error: DataRow dr = dsDBData.Tables[0].Rows[0]; foreach (DataColumn dc in dr) { MessageBox.Show(dc.ToString()); } Please help. "To teach is to learn twice"
-
Hi! I'm trying to print the values in my DataSet. It has a single row in it. I used this CommandText: "Select NAME from Authors" Now the query returns all the names. Now, I want to print the values in the dataset and I want to use foreach because I do not know how many names I might get. But the problem is, what do I use to traverse my set? I used this ff code but it generates an error: DataRow dr = dsDBData.Tables[0].Rows[0]; foreach (DataColumn dc in dr) { MessageBox.Show(dc.ToString()); } Please help. "To teach is to learn twice"
-
Hi! I'm trying to print the values in my DataSet. It has a single row in it. I used this CommandText: "Select NAME from Authors" Now the query returns all the names. Now, I want to print the values in the dataset and I want to use foreach because I do not know how many names I might get. But the problem is, what do I use to traverse my set? I used this ff code but it generates an error: DataRow dr = dsDBData.Tables[0].Rows[0]; foreach (DataColumn dc in dr) { MessageBox.Show(dc.ToString()); } Please help. "To teach is to learn twice"
You have more than one row and DataRow object doesn't contain Columns objects. See help on Data namespace. Should be: foreach(DataRow dr in dsDBData.Tables[0].Rows) { MessageBox.Show(dr[0].ToString()); } Hi, AW
-
You have more than one row and DataRow object doesn't contain Columns objects. See help on Data namespace. Should be: foreach(DataRow dr in dsDBData.Tables[0].Rows) { MessageBox.Show(dr[0].ToString()); } Hi, AW
-
A.Wegierski wrote: DataRow object doesn't contain Columns objects DataRow.Table.Columns Mazy No sig. available now.
:laugh:Thx Hi, AW