Click here to Skip to main content
12,445,482 members (59,956 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB 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
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...
pashad 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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160811.3 | Last Updated 12 Mar 2012
Copyright © CodeProject, 1999-2016
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