|
-
October 8th, 2001, 05:55 AM
#1
ADO Problem
Hi gurus,
In my Application there is a option to open a text file.I'm using Common dialog to do that.After I open a file in a floppy,then I exit my application an run it again,It is looking for the floppy drive when it is opening the database.I'm using ADO for the Opendatabase.
Do u know any clue about this.
Thankx in advance
Dinesh Asanka
-
October 8th, 2001, 07:01 AM
#2
Re: ADO Problem
This has got nothing to do with ADO, this has got to do with the Commondialog control. By default, the commondialog control opens with the path of the application. After you select a file with it, it will remember the location of that file when using it a second time. This happens until you quit your application. But when running in the VB IDE, it will keep it's value until the control is unloaded, and that is when you close the VB IDE, or close the project. You can override this behaviour by using the initdir property, which will open a specific folder.
CommonDialog1.InitDir = "c:\"
CommonDialog1.ShowOpen
This code will always open the Commondialogconrol in c:\, even if you selected a file on a:
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
October 8th, 2001, 07:12 AM
#3
Re: ADO Problem
Thankx for the answer.
But actually that error comes when I'm open the database again.Not at the common dialog box.I set the common dialog box values normally as u mentioned.
But it gives the error at the time of opening the database.
Dinesh Asanka
-
October 8th, 2001, 07:19 AM
#4
Re: ADO Problem
Are you opening the database from floppy, or is that text file you are talking about the only thing you need on floppy? Also, could you provide the code used for opening the database (including some lines of the commondialog control).
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
October 8th, 2001, 07:46 AM
#5
Re: ADO Problem
Your OpenDatBAse statement supplies the drive/path/name of the location of your database. If you omit drive or path, then VB will use the default, Whatever it currently is. In your case, selecting A: from the commonDialog control apparently sets the default to "A:/"
John G
-
October 8th, 2001, 10:19 PM
#6
Re: ADO Problem
Thankx for the reply.
Yes I agree with you,
Is there any way I can set the default path
Dinesh Asanka
-
October 9th, 2001, 01:31 AM
#7
Re: ADO Problem
You can use hte SetCurrentDirectory API Function for thet
[vbcode]
' in a module
Public Declare Function SetCurrentDirectory Lib "kernel32" Alias "SetCurrentDirectoryA" (ByVal lpPathName As String) As Long
' in a form
SetCurrentDirectory "C:\"
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
-
October 9th, 2001, 02:13 PM
#8
Re: ADO Problem
Use the CHDIR$ function
John G
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
|