Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than odbccp32, prefix the name with the module name and a period.
odbccp32.dll
.
SQLConfigDataSource
Signature
[DllImport("ODBCCP32.DLL",CharSet=CharSet.Unicode)]
internal extern static int SQLConfigDataSource (int hwndParent, int fRequest, string lpszDriver, string lpszAttributes);
fRequest:
ODBC_ADD_DSN
ODBC_CONFIG_DSN
ODBC_REMOVE_DSN
ODBC_ADD_SYS_DSN
ODBC_CONFIG_SYS_DSN
ODBC_REMOVE_SYS_DSN
ODBC_REMOVE_DEFAULT_DSN
More
lpszAttributes:
Supports Name value pairs.
More
Example:
public static bool CreateSQLDSN(string dsnName, string serverName, string dbName)
{
string Driver;
string attribs;
Driver = "SQL Server";
attribs = "SERVER=" + serverName + Convert.ToChar(0);
attribs = attribs + "DESCRIPTION=Test DSN" + Convert.ToChar(0);
attribs = attribs + "DSN=" + dsnName + Convert.ToChar(0);
attribs = attribs + "DATABASE=" + dbName + Convert.ToChar(0);
attribs = attribs + "Trusted_Connection=yes" + Convert.ToChar(0);
int intRet = win32apis.SQLConfigDataSource(0, win32apis.ODBC_ADD_DSN, Driver, attribs);
if (intRet == 1)
return true;
return false;
}
internal class win32apis
{
internal const int ODBC_ADD_DSN = 1;
[DllImport("ODBCCP32.DLL",CharSet=CharSet.Unicode)]
internal extern static int SQLConfigDataSource (int hwndParent, int fRequest, string lpszDriver, string lpszAttributes);
}
Namespace
odbccp32
Description
odbccp32.dll
Title
odbccp32.dll
Contact
Adam Nathan
Import
credui,advapi32,gdi32,kernel32,ole32,shell32,user32,glossary,coredll,rasapi32,mpr,netapi32,uxtheme,avifil32,aygshell,winscard,crypt32,secur32,wtsapi32,shlwapi,winspool,oleacc,rapi,oleaut32,winfax,odbc32,msi,cards,powrprof,urlmon,xolehlp,twain_32,winmm,wininet,comdlg32,imm32,ntdsapi,gdiplus,Constants,Delegates,Enums,Interfaces,Structures
This function is used to work with the ODBC DataSources.
1/10/2014 3:54:23 PM - http---joshuanorton.spaces.live.com-210.54.237.168
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).