Need Help

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 18
Reputation: deepukng is an unknown quantity at this point 
Solved Threads: 0
deepukng deepukng is offline Offline
Newbie Poster

Need Help

 
0
  #1
May 10th, 2008
Hello Friends,
I am learning VB.Net (Visual Studios 2005) and using MS Access as backend database. pls someone tell me how to connect VB.net to MS Access.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 38
Reputation: q8_dreamy is an unknown quantity at this point 
Solved Threads: 0
q8_dreamy q8_dreamy is offline Offline
Light Poster

Re: Need Help

 
0
  #2
May 11th, 2008
EASY

First, before defining the class write imports system.data.oledb

Second, inside your sub, you need to define a connection to the data base (for ex. Dim con as new oledbconnection)
then write the following:

con.ConnectionString = "provider=microsoft.jet.oledb.4.0; data source=C:\DB.mdb"

ofcourse instead of C:\DB.mdb you will write the drive where you saved the db and its name

then open your connection (con.open())


then define the command (dim cmcontact as new oledbcommand)
inside the command you will write the sql statement like insert to insert to the db also update or select

write the following 2 statements:

cmcontact.Connection = con
cmcontact.ExecuteNonQuery()
con.Close()


that is it my friend
Happy Coding
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC