Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

app.path and dataEnvironment

hello,
i'm trying to connect to a database using dataenvironment, in the connection string if the full path is writen like(c:\....\myDDB.mdb), the connection is established without any problem, neverthless if i introduce App.path into my script:
DataEnvironment3.Connection1
with .ConnectionString = App.Path & "\bd_mora\bd_moura.mdb;Persist Security Info=False;Jet OLEDB:Database Password=password"

an error appears:incorrect use of proprety
if anyone can help me i'll be so grateful!
thanks
[531 byte] By [harold] at [2007-11-11 8:46:59]
# 1 Re: app.path and dataEnvironment
The following worked for me:

DataEnvironment1.Connection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db2003.mdb;Persist Security Info=False"
DataEnvironment1.Connection1.Open

Your connection string looks a little messed up. I think you need to specify the provider. Also make sure that the ConnectionSource property of the DataEnvironment's Connection is set to a value (such as the path to your design time database) when you compile the application. It cannot be blank.
pclement at 2007-11-11 17:25:08 >
# 2 Re: app.path and dataEnvironment
i've tried the following script :
Set Connection1 = New Connection
With DataEnvironment3.Connection1
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = " data source= " & App.Path & "\bd_morassalati\bd_mourassalati.mdb;Persist Security Info=False"
'.Open
End With

DataEnvironment3.Connection1.Open"
and there is no error! the connection was established!
thanks
harold at 2007-11-11 17:26:05 >