Programmatically Creating and Registering a DSN in C++Primary Software: LabWindows/CVI Add-ons>>Enterprise Connectivity ToolsetPrimary Software Version: 1.1 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I want to create and register a DSN programmatically in C++ without using the administrator program. How can I do this? Solution: Creating and Registering Data Source Names (DSN) in C++ is accomplished by using the Windows SDK function call SQLConfigDataSource. This function processes requests based on the attributes passed into the function. Valid requests include allowing the user to add, remove, and configure DSNs. If a user wishes to add a new DSN and to register the DSN in the ODBC.ini file and the registry, two separate calls must be made to SQLConfigDataSource.
Making these two function calls will allow you to programmatically create and register your DSN. This can be especially useful on distributed applications where you do not want to require user input. For help and additional documentation on this function call please see the Microsoft link below. Related Links: External Site: Microsoft ODBC Programmer's Reference KnowledgeBase 2E7GIDDT: What Is the Difference between a System DSN, a User DSN, a File DSN, Universal Data Link (UDL), and DSN-less Connection? KnowledgeBase 3OSAJHTJ: Programmatically Creating Universal Data Link (*.udl / UDL) Files KnowledgeBase 2U2FII5A: Creating a DSN File To Communicate with Access Database in LabVIEW? Attachments:
Report Date: 12/30/2002 Last Updated: 12/31/2008 Document ID: 2ST89LJY |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
