471,317 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,317 software developers and data experts.

datatable field name and field values

Have sql return 2 rows 2 columns
Column A Column B
123 abc
234 cde
Cant get the Column names and column values any help?
do i need to loop objRead or datarow and datacolumn would be ok..
SqlDataReader objRead = m.DataRead(conn,sql);
DataTable myTable = objRead.GetSchemaTable();
while ( objRead.Read() )
{
foreach(DataRow myRow in myTable.Rows)
{
Console.WriteLine(myRow["ColumnName"].ToString());
foreach(DataColumn myCol in myTable.Columns)
{
Console.WriteLine((myRow["ColumnName"]).ToString());
Console.WriteLine("Column values");
}
}
}

Dec 13 '05 #1
0 1029

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by tomi | last post: by
reply views Thread by Chris Ericoli | last post: by
2 posts views Thread by ILCSP | last post: by
9 posts views Thread by Anil Gupte | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.