473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

VB in ASP.NET- Assigning SQL Data to variables

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
4 3603
BeMe
12
I suggest to copy it to Access - it could be a syntax problem
Jul 27 '08 #2
Curtis Rutland
3,256 Expert 2GB
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
bazeem
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
3,256 Expert 2GB
Glad to help. I actually wrote the second one :)
Jul 28 '08 #5

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

Similar topics

2
by: vidya | last post by:
Hi, I wrote a stored procdure in SQL Server which calculates some metrics. This procedure always returns only one row with 11 columns of integer values. I ran it in SQL Server Query Analyzer...
1
by: mhnazly | last post by:
i'm trying to read data from SQL Server database using data reader and assigned it to a label in my asp.net web application. but when the button is clicked, nothing appears. please help, thanks. ...
2
by: John A Grandy | last post by:
how do VB.NET numeric data-types match-up to SQL-Server numeric data-types ? is it safe to use declare VB.NET variables of type Integer to contain SQL Server columns of type Integer ?
2
by: Tarren | last post by:
Hi: What would be some standard convention to follow when writing web services for return types for .NET only data types? I initially wrote my web service that returns some XML as...
2
by: Andrew | last post by:
Win2k3 IIS6 ..NET 2.0 In my ASP.NET 2.0 app I create an open an SQL connection in the page's constructor and call objSQL.Dispose() in the destructor. The SQLConnection object is a class...
1
by: John Bailo | last post by:
I'm doing a profile on my SQL Server to see if I can eliminate any long running statements, and periodically, I see an entry for ".NET SqlClient Data Provider". The durations for it are very...
2
by: mpreisdorf | last post by:
I want to save the raw data of a class (without the .NET object overhead) to a binary file. For example: ref class Test { public: String^ name; Int32 number; ..... }
1
by: aj | last post by:
I'm trying to hook up some MS stuff to my DB2 LUW 8.2 FP14. Can anyone provide any guidance on .Net Framework Data Provider for DB2? Is there one? Where can I get it? I've been trawling thru...
2
by: Klaudiusz Bryja | last post by:
Hi I connect to Oracle 9.2 using System.Data.OracleClient. I call stored procedures and in cmd.ExecuteNonQuery I get error: "Internal .Net Framework Data Provider Error 30." StackTrace: in...
2
by: Max2006 | last post by:
Hi, I can see ASP.NET MVC and ASP.NET Dynamic Data extensions are not tagged as beta anymore here: http://www.asp.net/downloads/ Does this mean that we have the final release and we can...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.