Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access connection with workgroup file... 1

Status
Not open for further replies.

Ajb2528

Technical User
Feb 22, 2002
270
GB
I am trying to connect to a secured access 2000 mdb using vb.net. I have an app.config file that has the following connection string:-

<add key="SqlConnectionString" value="User ID=karen;pwd=karen;Data Source=C:\Development\EPOSImport\EPOSImport2000.mdb;Mode=Read/Write;Jet OLEDB:System database=l:\cas\system.mdw"/>


When I try to run the app, I get errors like:

Keyword not supported: Mode or if this is removeed:

Keyword not supported: Jet OLEDB:System database


I am using the following code to get to the data:

ssql = "select max(tblbatchesprocessed.id) as maxbatchid" & _
" from tblbatchesprocessed;"

Dim myConnrsgetbatchinfo As SqlConnection
myConnrsgetbatchinfo = New SqlConnection(ConfigurationSettings.AppSettings("SqlConnectionString"))
Dim myAdapterrsgetbatchinfo As New SqlDataAdapter(ssql, myConnrsgetbatchinfo)
myConnrsgetbatchinfo_Open()
Dim myDSrsgetbatchinfo As New DataSet
Dim myDRrsgetbatchinfo As DataRow
myAdapterrsgetbatchinfo.Fill
(myDSrsgetbatchinfo, "myDSrsgetbatchinfo")


Can anyone out there tell me where I am going wrong??


Regards,

Alan
 
Well since you're connecting to a MSAccess database, you will need to use the System.Data.Oledb namespace instead of System.Data.Sql.

Scott
Programmer Analyst
<{{><
 
I have the following declared....

Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SQlClient
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Data.OleDb

Should I change -

Dim myConnrsgetbatchinfo As SqlConnection

to

Dim myConnrsgetbatchinfo As OleDbConnection ...

Regards,

Alan

P.S. the access mdb has 'local' tables (ie native access tables) and also has links to SQL Server tables thru ODBC.
 
Yes, that is correct. Regarding your database with sql links, we have the same setup here. The OleDB will work with this design, but you'll need to make sure the ODBC DSN used to link the tables is installed on the client's pc.



Scott
Programmer Analyst
<{{><
 
Thanks for the info....

Regards,

Alan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top