Database Connection Problem

vujjeni

New member
Joined
Jun 5, 2003
Messages
2
I am trying to connect to a database in my bin/ and instead of setting up a oldDbConn at design time, I am coding it at run time.

Try
Dim app As AppDomain
Dim p As Application
Dim myPath1 = p.StartupPath
Dim myPath = app.CurrentDomain.BaseDirectory
myConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data Source=" & myPath1 &" \myDatabase.mdb;etc..etc

mydb = New OleDbConnection(myConnStr)
mydb.Open() ===>Unknown ERROR
myState = mydb.State()
Catch myerror As OleDbException
MessageBox.Show(myerror.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

I keep getting an UnKNOWN error at mydb.Open()...
Any suggestions as to what I am doing wrong ?
Thanks
 
myConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data Source=" & myPath1 &" \myDatabase.mdb;etc..etc

Hmm, could you copy/paste exactly what you have as the connection string? I dont see anything else wrong with your code. Use my_pass and my_user_id in replace of your Password and User ID, as I know you obviously dont want to give us that information.

Unknown error sounds a bit odd though.
 
myConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data Source=" & myPath1 & "\GraphicsProject.mdb;Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Dont Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False"

I copied it pasted it from a design time conn object..just changed the datasource path..The unknown error has some weird code...DB_SEC_E_AUTH_FAIL(Memory address)
 
Back
Top