VB 2005 and SQL Server

Apex

Skilled
Hi

I'm trying to create a project with VB 2005 and SQL Server 2005 (both express editions). I'd like to know how to connect my program to a database and then execute select, insert, update queries? How to fetch the results from a select statement in vb variables/arrays? Please note that I want to do all these in code itself and not by using any wizard or tool etc.

Any help in this regard will be much appreciated.
Thanx.
 
hey QF......

VB 2005 and for that matter any of the products in that suite (VC2005, VC#2005) etc are all based of .NET 2.0

Hence the way of accessing this data will be same whatever language you choose. Just the language constructs will be differnet.

I will outline the procedure. However, if you need detailed help, I will be glad to help you out.

1) Create a connection (SqlConnection) by supplying appropiate connection string.

2) Make sure you connected okay. Try-Catch works like a charm here.

3) Execute your query using SqlCommand class.

Ofcourse, this is one of the ways. I am sure there are numerable others.

Regards,

Karan
 
thanx...figured that out myself

but there;s a prob

i can use select statement to display the data frm db

but i can't make use of insert and update queries

somehow those are not commited to the db.

any help?
 
QuickFire said:
thanx...figured that out myself
but there;s a prob

i can use select statement to display the data frm db
but i can't make use of insert and update queries
somehow those are not commited to the db.
any help?

sql procedures would do the trick....
I've not written anything for the past 2 years, but give it a shot. procedures buddy!
 
Back
Top