Application.StartupPath and mdb problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Ddraig (ddraig_at_futuredroids-dot-com.no-spam.invalid)
Date: 09/23/04


Date: 23 Sep 2004 11:03:48 -0500

Howdy,

I've spent a good 2 or 3 hours this morning trying to figure out this
code. I'm new to the .Net environment and have some VB6 skills but
that was 3 years ago.

My project I'm working on accesses a Access DB to pull in data. I used
the designer to pull in the components I needed to connect to the
database.

Here is my Code:

Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
        "ocking Mode=1;Data Source=""C:\Owens\Visual Studio
Projects\Tailoring\bin\tailori" & _
        "ng.mdb"";Mode=Share Deny None;Jet OLEDB:Engine
Type=5;Provider=""Microsoft.Jet.OLE" & _
        "DB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist security info=Fal" & _
        "se;Extended Properties=;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB" & _
        ":Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't C" & _
        "opy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global
Bulk Transactions=1"

I think this is a bit over kill, but what I'm trying to do is get it
so that I can put in the relative path to the database instead of
literal. However, when I change the datasource path it gives me an
error with my dataset.

Example of that code here:

Dim dbPath as String =
Application.StartupPath & "\tailoring.mdb"

Me.OleDbConnection1.ConnectionString = "Jet OLEDB:Global Partial Bulk
Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _
        "ocking Mode=1;Data
Source=[b:6e962dc7b3]dbPath[/b:6e962dc7b3];Mode=Share Deny None;Jet
OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLE" & _
        "DB.4.0"";Jet OLEDB:System database=;Jet
OLEDB:SFP=False;persist security info=Fal" & _
        "se;Extended Properties=;Jet OLEDB:Compact Without Replica
Repair=False;Jet OLEDB" & _
        ":Encrypt Database=False;Jet OLEDB:Create System
Database=False;Jet OLEDB:Don't C" & _
        "opy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global
Bulk Transactions=1"

This is the Error I get when I attempt to run it with that code.

An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in system.data.dll

Code for that line is: OleDbDataAdapter1.Fill(DataSet1)

Anyone have any suggestions?



Relevant Pages

  • Re: MS Access table and field properties
    ... http://www.oledbdirect.com - The fastest way to access MS SQL Server, ... MS Jet and Interbase (through OLEDB) ...
    (borland.public.delphi.database.ado)
  • Re: Update funktioniert nicht
    ... System.Data.OleDb verwendet doch die unmanged OleDb Schnittstellen. ... Wie kann dann eine Optimierung auf Jet erfolgen? ... auf den SQLClient-Namensraum verzichten können und bei den mit OleDb ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Re: ID =?ISO-8859-15?Q?erh=F6hen_-_unbekannter_Fehler?=
    ... Hallo Thomas, ... Das erste und größte ist dabei die Jet. ... dann mit JRO / OleDb Client ohne Pooling usw. rumjongliert. ... Mit Aufwand (und ADO Classic) ginge die Variante: ...
    (microsoft.public.de.german.entwickler.dotnet.datenbank)
  • Re: Verbindungsserver Microsoft.ISAM.OLEDB.1.1
    ... Provider verwenden, den Jet 4.0 Treiber mit seiner ISAM ... Funktionalitäten oder den VFP OleDB Provider. ...
    (microsoft.public.de.sqlserver)
  • Connection String Dramas with JET and Directory GetCurrentDirectory
    ... Hi I am using the Visual Studio connection string. ... 'OleDbConnection ... Me.OleDbConnection.ConnectionString = "Jet OLEDB:Global Partial Bulk ...
    (microsoft.public.dotnet.framework.adonet)