|
-
Oct 10th, 2008, 07:29 AM
#1
Thread Starter
Member
[RESOLVED] data environment and path to db
I have built my app using VB6 and it runs from a usb thumbdrive. I use a coded connection to my db as follows
Code:
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\stock.mdb"
What this provides is basically wherever my app runs, so long as the db is in the same folder it can find and use it. However, when I come to print the datareport I get errors. (I believe it's a 713?)
What I would like to know is, can this type of connection be used in the data environment which currently connects to the db like this
Code:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\stock\stock.mdb;Persist Security Info=False
This will only print the datareport if the db is on the F:\stock drive folder. It needs to be dynamic as not every computer will make the app folder F.
I have tried substituting the code but it doesn't seem to want to know.
Any ideas greatly appreciated.
-
Oct 10th, 2008, 09:27 AM
#2
Re: data environment and path to db
In code you can override the property settings
DataEnvironment1.Connection1.ConnectionString = "provider=..."
The dataenvironment is a global object so this can be done anywhere. Sub Main or Form_Load of the main form.
Another place is the DataEnvironment's WillConnect event.
-
Oct 12th, 2008, 02:54 AM
#3
Thread Starter
Member
Re: data environment and path to db
 Originally Posted by brucevde
In code you can override the property settings
DataEnvironment1.Connection1.ConnectionString = "provider=..."
Excellent. Seems to work like a charm but I won't get a chance to try it properly until tomorrow.
Cheers.
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
|