> >#DEFINE ODBC_ADD_DSN 1 &&' Add data source >#DEFINE ODBC_CONFIG_DSN 2 &&' Configure (edit) data source >#DEFINE ODBC_REMOVE_DSN 3 &&' Remove data source >#DEFINE vbAPINull 0 &&' NULL Pointer > >*'Function Declare >DECLARE LONG SQLConfigDataSource IN ODBCCP32.DLL ; > LONG hwndParent, LONG fRequest, ; > STRING lpszDriver, STRING lpszAttributes > >LOCAL intRet, strDriver, strAttributes > >*'Set the driver to SQL Server because it is most common. >strDriver = "Microsoft Visual FoxPro Driver" && "SQL Server" >*'Set the attributes delimited by null. >*'See driver documentation for a complete >*'list of supported attributes. >*strAttributes = "SERVER=SomeServer" + CHR(0) > >strAttributes = "DESCRIPTION=Temp DSN" + CHR(0) >strAttributes = strAttributes + "DSN=Amline3.0" + CHR(0) >strAttributes = strAttributes + "SourceType=DBC" + CHR(0) >strAttributes = strAttributes + "SourceDB =" + goapp.cdefaultdirectory + "AMLINE.DBC" + CHR(0) >*strAttributes = strAttributes + "UID=sa" + CHR(0) >*strAttributes = strAttributes + "PWD=" + CHR(0) >*'To show dialog, use Form1.Hwnd instead of vbAPINull. >intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_DSN, ; > strDriver, strAttributes) > >>