@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: Gets a list of names of values or data corresponding to a value of the system information (MSDN ODBC Programmer's Reference). This function works similarly to the GetProfileString() Win32 API function. !!!!C# Signature: [DllImport("odbccp32.dll", SetLastError=true)] static extern int SQLGetPrivateProfileString(string lpszSection, string lpszEntry, string lpszDefault, [Out] char[] retBuffer, int cbRetBuffer, string lpszFileName); !!!!VB Signature: Declare Function SQLGetPrivateProfileString Lib "odbccp32.dll" (TODO) As TODO !!!!User-Defined Types: None. !!!!Sample Code: This function persists a system data source with the provided name and connection string. Remember to add your own error checking mechanisms. void UpdateDSN(string dataSourceName, string connStr) { char[] value = new char[8192]; // Try to retrieve the driver for the data source SQLSetConfigMode(ConfigMode.ODBC_SYSTEM_DSN); SQLGetPrivateProfileString(dataSourceName, "Driver", "", value, value.Length, "odbc.ini"); // Set our configuration mode RequestFlags configMode = value[0] == '\0' ? RequestFlags.ODBC_ADD_SYS_DSN : RequestFlags.ODBC_CONFIG_SYS_DSN; // Connection string for SQLConfigDataSource must be null- // character delimited and double null-terminated string s = connStr.Replace(';', '\0'); s += '\0'; // Persist the data source SQLConfigDataSourceW(0, configMode, MY_DRIVER_NAME_STRING, s); } Documentation: SQLGetPrivateProfileString@msdn on MSDN
Edit odbccp32.SQLGetPr...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.