Home > Software engineering >  Questions about VB reference database path
Questions about VB reference database path

Time:09-26

VB program contains a database query function, this requires that I specified in advance in the application database path, if my VB program installed on different computers, and each computer has a different database name and path? I want to do a page in the VB program manually locate the function of the database Path, do not know whether can implement, the other, see online mostly is recommended App. The Path method, don't want to use this method, because the database does not generally exist on the system disk, please everyone give advice or comments, thanks a lot!!!!!

CodePudding user response:

No one knows or can't achieve that?

CodePudding user response:

Your design direction is wrong, multiple computers use should not use the ACCESS database, using SQL Server, specify a database Server
File database path concept, the concept of the database server, there is no path

CodePudding user response:

With Microsoft Common Dialog Control 6.0 controls, ShowOpen () method is used to locate files,
VB own SaveSetting/GetSetting method save/reading configuration,
The configuration is stored in the registry HKEY_CURRENT_USER \ Software \ VB and VBA Program Settings \ & lt; AppName> Under \,

CodePudding user response:

With essentially a proposal database

CodePudding user response:

Single machine with Access to multiple clients with used, such as Oracle,

CodePudding user response:

Give you an idea, set up a database connection in the program interface, this interface can enter the database name, path, click ok, stored in the Access database, so the computer database name and the path of the database, then connect to the database should be no problem now,

CodePudding user response:

The above said method is to your program in C set, and the ACCESS database in other partitions, if you directly to the exe files, database copy to any partition, you can use the App. The Path method, after copying the exe file also can be a shortcut on the desktop, but the premise is must have the VB platform, namely all register OCX controls,

CodePudding user response:

Can use the registry, save or use file save can
To run a file location form, select complete save to a text file or registries can
Use CommonDialog control + API ShellExecute can choose
Add a CommonDialog
 '
control'general statement
Private Declare Function ShellExecute Lib "Shell32. DLL" Alias "ShellExecuteA" (ByVal HWND As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOW=5


'button eventsPrivate Sub Command1_Click ()
On Error GoTo userCanceled
With CommonDialog1
. CancelError=True
The Flags=cdlOFNHideReadOnly Or cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNNoDereferenceLinks
. The Filter="MDB files (*. MDB) | *. MDB"
. ShowOpen
ShellExecute Me. HWND, "open", FileName, ""," ", SW_SHOW
End With
UserCanceled:
End Sub
  • Related