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 OLEDBatabase 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 OLEDBon'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 OLEDBatabase L" & _
"ocking Mode=1;Data Source=dbPath;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 OLEDBon'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?
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 OLEDBatabase 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 OLEDBon'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 OLEDBatabase L" & _
"ocking Mode=1;Data Source=dbPath;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 OLEDBon'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?