Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

REPOST System.Data.DataTable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Smith - 05 Mar 2008 08:59 GMT
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.
Aidy - 05 Mar 2008 09:24 GMT
r = dt.Rows(i)
i = r("FieldName")

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

i = r.Item("FieldName")

> This works:
>
[quoted text clipped - 9 lines]
>
> Please help and sorry for incomplete info.
John Smith - 05 Mar 2008 09:52 GMT
The problem is that I don't know field name. :(
Aidy - 05 Mar 2008 11:16 GMT
> 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;

}
John Smith - 05 Mar 2008 11:49 GMT
> foreach (DataColumn col in dt.Columns)
>
[quoted text clipped - 3 lines]
>
> }

Thank you. I will try that.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.