Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I would like to connect to a SQL Server in Visual Basic within an aspx application. I do have the connection string. How do I connect to the database and execute SQL statements?

Thanks
Posted
Comments
Herman<T>.Instance 6-Oct-11 6:54am    
what is your exact problem?

use SqlCommand class to communicate with the database if the sql server is MS Sql Server
 
Share this answer
 
Comments
Reiss 6-Oct-11 7:09am    
I think you meant SqlConnection class to communicate, as you run the commands against the connection.
Herman<T>.Instance 6-Oct-11 16:37pm    
yep that is what I mean!
chris085 6-Oct-11 7:14am    
Could you give an excample (code)?
SQL Statement looks like this: "Select name from person where id = '" + field1.Text +"'"
I'm interested in establishing the connection and then executing this query.
I would start by reading through this

ADO.NET Code Examples[^]
 
Share this answer
 
http://www.cs.swan.ac.uk/~csneal/ReliableWeb/Example.html[^]

Follow this link......for GUI exaplaination.....:)

 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900