REPOST System.Data.DataTable

J

John Smith

This works:

Dim dt As System.Data.DataTable
Dim r As System.Data.DataRow = dt.Rows.Item(i)
i = r.Item(2)

But, I would like to retirive column value by entering
column name not by index ( r.Item(2)
). The problem is that I don't know column name and I would like somehow to
list all column names of DataTable. How can I do that?

Please help and sorry for incomplete info.
 
A

Aidy

r = dt.Rows(i)
i = r("FieldName")

Not too hot on VB.net, you might need;

i = r.Item("FieldName")
 
A

Aidy

John Smith said:
The problem is that I don't know field name. :(

Sorry, didn't read the question. To get all the column names (sorry it's in
c#)

foreach (DataColumn col in dt.Columns)

{

string name = col.ColumnName;

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top