|
-
May 17th, 2008, 06:46 PM
#1
Thread Starter
New Member
Relative path for ADO to connect to a MS Access DB (VB6.0)
Hi,
I'm working on a VB 6.0 application to access a MS Access database, and I need to use a relative path to connect to the BD, once it's suppose for it to work in different computers... And, while with an absolute path, it works perfectly, whenever I try a realtive path, there's always something wrong... And I've already try many ways:
First, I tried this:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source='..\Calendário de Eventos.mdb';"
Then, this:
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & Application.StartupPath & "\Calendário de Eventos.mdb';"
I've also tried this:
Private Sub Form_Load()
Adodc1.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & app.path & "\Calendário de Eventos.mdb;"
Adodc1.RecordSource = "Select * From Avaliacoes"
Adodc1.Refresh
End Sub
And this (yeah, i know it's getting annoying...):
m_DBConnection.ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Persist Security Info=False;" & "Data Source=" & calendario_de_eventos.mdb
m_DBConnection.Open
(yeah, I now changed the filename of my DB, once spaces and ´ could generate problems, but the errors persist)
And also this one, similar to the previous:
m_DBConnection.Open "Provider=Microsoft.Jet.OLEDB.3.51;" & "Persist Security Info=False;" & "Data Source=" & calendario_de_eventos.mdb
(NOTES: Calendário de Eventos.mdb, as well as calendario_de_eventos.mdb, are my database names; Avaliacoes is the table from that DB that I want to display, and I'm using DataGrid for this)
Still, there are errors; currently, the error is this one: the name of the data source hasn't been found and no default controller was specified (my error was in portuguese, so this translation may fail somehow, though I think it's fine)
So, I wonder what is wrong with my program that makes impossible the use of relative paths? is there any tip you can give me? I would so appreciate if got this problem solved!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|