caribbeanzuloo.blogg.se

Universal database dsn format
Universal database dsn format






  1. #Universal database dsn format driver
  2. #Universal database dsn format code

#Universal database dsn format code

This code creates the new DSN key in the Windows Registry. Now place code in the click event for the command button cmdCreateRegKey (see Listing 1). Private Declare Function RegCloseKey Lib "advapi32.dll" _ Private Declare Function RegSetValueEx Lib "advapi32.dll" _Īlias "RegSetValueExA" (ByVal hKey As Long, _īyVal lpValueName As String, ByVal Reserved As Long, _ Private Declare Function RegCreateKey Lib "advapi32.dll" _Īlias "RegCreateKeyA" (ByVal hKey As Long, _īyVal lpSubKey As String, phkResult As Long) As Long Private Const HKEY_CURRENT_USER = &H80000001

universal database dsn format

Private Const HKEY_LOCAL_MACHINE = &H80000002 This code goes to the General Declaration section of the form: Option Explicit Open a new Visual Basic project, and put a command button on the default form. Here you create the Windows Registry key for the DSN connection using the RegCreateKey, RegSetValueEx, and RegCloseKey API functions. I'll show you different ways to create DSN and DSN-less connections in VB6. The DSN-less connections pass up the calls to the Windows Registry. The DSN-less connections are appreciably faster than the system DSN connections, which, in turn, are faster than the file DSN. In this case, you don't need to re-create a DSN every time you change the location of your application from one server to another. A DSN-less connection can be especially useful for Web applications. This approach eliminates a few steps that require the user or system administrator to create a DSN on each computer. Specifying the DSN and connection to the database in VB increases the flexibility of your application and makes your installation simpler. Commonly, you can create the DSN with the ODBC Data Source Administrator, which you can access from the Windows Control Panel or Administrator Tools (in Windows 2000).

universal database dsn format

You could also define this information in the Visual Basic code that specifies the connection string. You can store this information in the Windows Registry where the DSN was created, or in the file DSN.

#Universal database dsn format driver

The connection information includes a data source name (DSN), the location of the server, the database name, the logon information, a password, and driver options. You must have key connection information to connect any application with a data source (database), including Microsoft Access, SQL Server, Oracle RDBMS, and others. Instead, use VB code to configure the connection. Increase your application's flexibility and make the installation simpler by connecting to the database without generating a DSN in the ODBC Data Source Administrator. In-Depth Create a DSN-Less Database Connection








Universal database dsn format