assigning a variable a value from a sql query

lional

Member
Joined
Apr 10, 2012
Messages
16
Programming Experience
Beginner
Hi
I am trying to query a MSSQL table and pull all the fields from the database and then assign them to the text fields on the form.
What I am struggling with is how I would assign the text box the value of the database table field.

Thanks

Lional
 
I am retrieving one record. The record has about 50 fields and each field is assigned to a seperate variable

Thanks
 
Then use a SqlCommand, call ExecuteReader to create a SqlDataReader and read each field individually and assign it to the appropriate property of the appropriate control. For an example of using a data reader, amongst others, check out this thread:

Retrieving and Saving Data in Databases
 
Back
Top