DataGrid Viewing
|
Edit by moderator:
Split from this thread.
See our Posting Guidelines for our policy on archived threads.
I am confused as to where to place the following code snippet in my code. I put the function above my load event and the same exception still occurs:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
This happens at:
Code:
da.Fill(ds)
Is there another method at creating a dataset to view my data from my databsase?
Any help that you could advise would be greatly appreciated.
Code:
Private Function GetConnectionString(ByVal Database As String) As String
Dim sConnection As String
sConnection = "Jet OLEDB:Global Partial Bulk Ops=2;" & _
"Jet OLEDB:Registry Path=;" & _
"Jet OLEDB:Database Locking Mode=1;" & _
"Data Source=""" & Database & """;" & _
"Mode=Share Deny None;" & _
"Jet OLEDB:Engine Type=5;" & _
"Provider=""Microsoft.Jet.OLEDB.4.0"";" & _
"Jet OLEDB:System database=;" & _
"Jet OLEDB:SFP=False;" & _
"persist security info=False;" & _
"Extended Properties=;" & _
"Jet OLEDB:Compact Without Replica Repair=False;" & _
"Jet OLEDB:Encrypt Database=False;" & _
"Jet OLEDB:Create System Database=False;" & _
"Jet OLEDB:Don't Copy Locale on Compact=False;" & _
"User ID=Admin;" & _
"Jet OLEDB:Global Bulk Transactions=1"
Return sConnection
End Function
Just pass it the name of the database and it will do the rest. If your database
is in the application directory you can call it like this. Otherwise in the whole path to your file
Code:
dim myConnection as New Oledb.OledbConnection
myConnection.ConnectionString = GetConnectionString(System.IO.Directory.GetCurrentDirectory() & "\test.mdb")
[/QUOTE]
|
Last edited by lebb; 05-21-2008 at 11:19 AM.
Reason: Split new question to separate thread
|