By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,382 Members | 2,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,382 IT Pros & Developers. It's quick & easy.

VB in ASP.NET- Assigning SQL Data to variables

P: 3
I am extremely new to programming and Visual Basic.

I want to know how to read data from an SQL database and assign it to a variable.
For example if I have a database with three columns (like below)

First Name | Last Name | Age
Ebrahim | E | 26
Sam | Menodza | 24
Sean | Steven | 54


and I want to assign Sean's age to a variable called sAge notwithstanding that I would first have to check/query the First Name columns for the value of "Sean".

What code would I use to accomplish all of this (querying first column/ assigning variable sAge to requested value)? Could you give me a complete code if possible (ie include Connection Strings codes if necessary).-please.

Thanking you very much in advanced
P.S: I would like the code to be in VB
Jul 27 '08 #1
Share this Question
Share on Google+
4 Replies


P: 12
I suggest to copy it to Access - it could be a syntax problem
Jul 27 '08 #2

Curtis Rutland
Expert 2.5K+
P: 3,256
We have two articles that are just what you need to read.

How to use a database in your .net program
How to use a database in your .net program part II

Code samples and all.
Jul 27 '08 #3

P: 3
We have two articles that are just what you need to read.

How to use a database in your .net program
How to use a database in your .net program part II

Code samples and all.
Thank you soo much for this reference. There is just so much posts to browse through, I didnt see this one.
Jul 28 '08 #4

Curtis Rutland
Expert 2.5K+
P: 3,256
Glad to help. I actually wrote the second one :)
Jul 28 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.