/ ** * Generate ODBC Data Source * @Param Sserver [in] Database Server Name * @Param SDBNAME [In] Database Name * / BOOL CQQMiseRapp :: Createsqldsn (Char * Sserver, Char * SDBNAME) {char * szdriver = "SQL Server "; char szattributes [300], * p; zeromeMory (Szttributes, 200); char TEMP [100];
/ / Generate name value pairs P = Szattributes; strcat (p, "dsn = miser"); p = strlen ("DSN = MiSer") 1; strcat (p, "description = miser data source); p = Strlen ("Description = MiSer Data Source") 1; Sprintf (Temp, "Server =% S", SSERVER); STRCAT (P, TEMP); P = Strlen (TEMP) 1;
Sprintf (Temp, "Address =% S", SSERVER); STRCAT (P, TEMP); P = Strlen (TEMP) 1;
STRCAT (P, "NetWork = DBMSOCN"); P = Strlen ("NetWork = DBMSSOCN") 1; Sprintf (Temp, "Database =% S", SDBNAME); STRCAT (P, TEMP);
SqlconfigDataSource (NULL, ODBC_ADD_SYS_DSN, SZDRIVER, SZATTRIBUTES);
Return True;}