Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Please i have the following text boxes on my aspx form corresponding to fields on a table named;
txtClientID, txtFirstName,txtLastName, txtDOB, txtDateRegistered,txtExpiryDate
I want to retrieve data stored in the corresponding fields in an sql server 2005 database table named;ClientDatails
I want to use DataReader to achieve this can you please help me
Posted
Updated 12-Mar-12 2:08am
v2
Comments
ChandraRam 12-Mar-12 8:08am    
What have you tried so far? Post your code and say where you are stuck...
Prasad_Kulkarni 12-Mar-12 8:09am    
Dont use capital letters.

VB
Dim cnPodaci AsNew SqlConnection
cnPodaci.ConnectionString = "your connection string"
cnPodaci.Open()
Dim cm AsNew SqlCommand
cm.CommandText = "SELECT * FROM TABLE"
cm.Connection = cnPodaci
Dim dr As SqlDataReader
dr = cm.ExecuteReader

If dr.HasRows Then

dr.Read()
txtBox1.text = dr.Item("ColumnName1")
txtBox2.text = dr.Item("ColumnName2")

dr.Close()

EndIf
cnPodaci.Close()
 
Share this answer
 
Comments
Member 9971240 20-Apr-13 14:43pm    
Thank you very much!
read this[^]!
 
Share this answer
 

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