954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Connecting to access database

0
By Jadranko Dragoje on Sep 11th, 2006 12:56 pm

Code for connecting to Microsoft Access databse, opening and closing connection

Dim cn As New OleDbConnection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|Data.mdb;Persist Security Info=True"
cn.Open()
cn.Close()

hello sir. i tried that code but it doesn't work. it says that it's not defined. what should i do?

dengbadeng
Newbie Poster
1 post since Feb 2008
Reputation Points: 10
Solved Threads: 0
 

did you add a header to it ? add 'imports system.data.oledb' as the header and try

kavithabhaskar
Junior Poster
124 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

which dbr u using-- access 2003 or 2007 ??
the code is for 2003
for 2007 use
"Provider=Microsoft.ACE.OLEDB.11.0;Data Source=|DataDirectory|Data.ACCdb;Persist Security Info=FALSE"

N A MSGBOX

pocohontus
Newbie Poster
9 posts since Nov 2008
Reputation Points: 10
Solved Threads: 1
 

'firs import

imports system.data.oledb
Dim con As New OleDbConnection()
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=h:\MAINDB.mdb;"
con.open
statements
con.close
uv4u
Light Poster
48 posts since Jan 2011
Reputation Points: 10
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You