Click here to Skip to main content
15,902,447 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have created a datasource to connect with SQL Data Base. It works fine when I connected it with GridView. I need to read certain item (say FirstName) and store the value to a variable.
How can I use this datasource? Could you give me the statements for that?


1 solution

You have got your Datasource by name ds(say),

Now, you can read the particular values as :

Dim FirstName As String = Convert.ToString(ds.Tables("TableEmp").Rows(0).Item("FirstName"))

I hope this solves your query.

Share this answer
Furqan Sehgal 4-Sep-11 10:22am    
It does not work. MyDataSource. does not display Tables or further commands that you mentioned. Please note I am using
@nuraGGupta@ 4-Sep-11 10:38am    
ohhh sorry, I posted my answer in C#, please see my updated answer (Although that is not much different).
Furqan Sehgal 4-Sep-11 10:56am    
It says Table is not a member of system.web.ui.webcontrols........
@nuraGGupta@ 4-Sep-11 11:04am    
I guess when you say datasource, you mean dataset. The given link may help you out :
Wendelius 4-Sep-11 11:37am    
I believe that the OP means a datasource, not dataset. For example:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900