Hi friends....


how to connect MS.Acess database into vb.net......

is any ODBC setting needed?

Recommended Answers

All 4 Replies

Hi friends....


how to connect MS.Acess database into vb.net......

is any ODBC setting needed?

You can connect through oleDB (no ODBC required):

Dim SelectText as String = "Select * from myTable"
 
Dim SqlConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\asp_examples1\test.mdb
 
Dim myDA As oledb.oledbDataAdapter= New oledb.oledbDataAdapter(SelectText, SqlConn)

Ned

yes, of course you'll have to make an odbc connection and in your vb.net project you have to download the odbc reference.

To open a database in vb.net:

sconbase = "PROVIDER=MSDASQL;dsn=bdraacp;"
db = New ADODB.Connection
db.CursorLocation = ADODB.CursorLocationEnum.adUseClient
db.Open(sconbase)


the string in dsn it is the odbc connection

be attention to possible errors, please use exceptions to avoid mistakes in the application.

Regards,
Guimas_Boy

yes, of course you'll have to make an odbc connection and in your vb.net project you have to download the odbc reference.

Regards,
Guimas_Boy

Guimas provides the method IF you want to use ODBC. The original question was whether or ODBC is required. See my post two above this one - the code I provided is the sum total of what's required to connect without creating an ODBC connection.

Thanks!

Ned

Hi NedFrankly...

Thanks. it will work. thank u very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.