Using odbc manager1/8/2023 ![]() Function PrototypeīOOL SQLConfigDataSource(HWND hwndParent,UINT fRequest, LPCSTR lpszDriver, LPCSTR lpszAttributes) Much of the information is taken from the ODBC API Programmer's Reference supplied with Visual C version 1.5 and later. The following explains the parameters of the ::SQLConfigDataSource function. For example, your code is portable from 16 bit to 32 bit if you use the ::SQLConfigDataSource function, because the function correctly writes to the Odbc.ini file or to the registry. It is generally advisable to use an API function when one is provided. If a later revision to the ODBC Driver Manager implements record keeping about data sources in a different way, any application that uses this technique is broken. It is important to know what information needs to be placed in the registry because you need to supply it with the call to ::SQLConfigDataSource.Īlthough this information could be written directly to the registry without using ::SQLConfigDataSource, any application that does so is relying on the current technique that the Driver Manager uses to maintain its data. The ODBC Driver Manager queries this file to obtain the required information about the data source. ODBC Administrator (typically installed in Control Panel) creates a new data source by putting entries in the Windows registry (or, for 16 bit, in the Odbc.ini file). However, sometimes it is desirable to create a data source name directly from your application to obtain access without requiring the user to run a separate utility. You can create an ODBC data source name using ODBC Administrator or a similar utility. Also, Odbccp32.dll must be in the path at run time (or Odbcinst.dll for 16 bit). To use ::SQLConfigDataSource, you must include the Odbcinst.h header file and use the Odbcinst.lib import library. The following information discusses the parameters that need to be passed to the ::SQLConfigDataSource ODBC API function. xls file).įor more information about creating tables, see Data Source: Programmatically Creating a Table in an ODBC Data Source. The Excel driver uses directories as its data sources and files as the individual tables (one table per. Note that the data source is actually a directory (C:\EXCELDIR) this directory must exist. SQLConfigDataSource(NULL,ODBC_ADD_DSN, "Excel Files (*.xls)", The following example uses the ::SQLConfigDataSource ODBC API function to create a new Excel data source called New Excel Data Source: For example, when using the SQL Server ODBC driver, you need to have established a SQL Server computer. Drivers for other ODBC databases, such as Microsoft Access and SQL Server, require that some specific criteria be satisfied before a data source can be established. That is, a directory is the data source and each table within the data source is stored in a separate file (in the case of dBASE, each table is a. Some data sources maintain a directory specification for databases. However, many DBMSs allow programmatic data source creation. mdb file that you can use or copy whenever you need it. Therefore, if your application requires that you place data into a Microsoft Access data source (.mdb file), you most likely want to have an empty. There is no programmatic way of creating the. When creating a Microsoft Access ODBC data source through ODBC Administrator, you are given two choices: you can select an existing. Typically, a user runs ODBC Administrator to create a data source if the associated database management system (DBMS) supports this operation. This gives you flexibility to access data without forcing the user to explicitly use the ODBC Administrator or other programs to specify the names of data sources. This topic explains how you can configure Open Database Connectivity (ODBC) data source names programmatically. Data Source: Programmatically Configuring an ODBC Data Source
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |