/**
* 生成ODBC数据源
* @param sServer [IN]数据库服务器名
* @param sDBName [IN]数据库名
*/
bool CQQMiserApp::CreateSqlDSN(char * sServer,char * sDBName)
{
char *szDriver = "SQL Server";
char szAttributes[300],*p;
ZeroMemory(szAttributes,200);
char temp[100];
//生成名值对
p = szAttributes;
strcat(p,"DSN=miser");
p+=strlen("DSN=miser")+1;
strcat(p,"DESCRIPTION=miser数据源");
p+=strlen("DESCRIPTION=miser数据源")+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=dbmssocn");
p+=strlen("NETWORK=dbmssocn")+1;
sprintf(temp,"DATABASE=%s",sDBName);
strcat(p,temp);
SQLConfigDataSource(NULL,ODBC_ADD_SYS_DSN,szDriver,szAttributes);
return true;
}