Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET VB.NET
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 12-Mar-12 2:05am
Edited 12-Mar-12 2:08am
v2
Comments
ChandraRam at 12-Mar-12 8:08am
   
What have you tried so far? Post your code and say where you are stuck...
pashad at 12-Mar-12 8:09am
   
Dont use capital letters.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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()
  Permalink  
Comments
Member 9971240 at 20-Apr-13 14:43pm
   
Thank you very much!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

read this[^]!
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 328
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 292
3 ClimerChinna 232
4 Abhinav S 192
0 Sergey Alexandrovich Kryukov 8,213
1 OriginalGriff 7,089
2 CPallini 2,598
3 Richard MacCutchan 1,925
4 Abhinav S 1,778


Advertise | Privacy | Mobile
Web03 | 2.8.140826.1 | Last Updated 12 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100