switch data source in an application

switch data source in an application

Post by Lin Che » Thu, 07 Jan 1999 04:00:00



Current I have a VC++4.2 application within which I need to switch data
sources(from SQL Server 2.65.0252 to MS Access 3.50.360200 and vice versa).
After one data source disconnect (SQLDisconnect, SQLFreeConnect &
SQLFreeEnv) I could not immediately connect to another data source.  I don't
get any error message when I connect.  After while (Access to SQL Server
connection took longer time than SQL Server to Access connection), I can get
connected.

Anyone has any thought?

Thanks.

 
 
 

1. Data Source: Programmatically Configuring an ODBC Data Source - HELP PLEASE

OP: WIN95
COMPILER: VCPP 5.0 (SVP 2)

I have the above code, and I don't know why the "OPTION 1" does not work.
The contents of "p" in memory is the same as 2nd and 3rd line of the "OPTION
2" before the SQLConfigDataSource function.
Thanks, for any help.

char *p = new char[100];
char cCnt = 0;
memset(p,NULL,100);
CString strDummy = "DNS=TESTESQL";

for(char i=0;i<strDummy.GetLength();i++)
     p[cCnt++] = strDummy.GetAt(i);

p[cCnt++] = NULL;

strDummy = "DBQ=C:\\Projetos\\SRO_CPQD\\SOFTWARE\\PRS
TESTE\\PRS\\MDB\\sro.mdb";

for(i=0;i<strDummy.GetLength();i++)
     p[cCnt++] = strDummy.GetAt(i);
p[cCnt++] = NULL;
BOOL bRet = FALSE;
// ***** OPTION 1 *****
bRet = SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver
(*.mdb)",p);

// ***** OPTION 2 *****
bRet = SQLConfigDataSource(NULL,ODBC_ADD_DSN,"Microsoft Access Driver
(*.mdb)",
        "DSN=TESTESQL\0"
        "DBQ=C:\\Projetos\\SRO_CPQD\\SOFTWARE\\PRS
TESTE\\PRS\\MDB\\sro.mdb\0");


2. Century Parameter

3. Help:ODBC Data Source Admin doesn't show Names of new Data Sources

4. Multiblock_read_count setting

5. cannot add MSAccess 97 data source in ODBC Data Source Admin

6. Why am I using PARADOX!

7. ODBC Problem with Access 7.0 Data Sources (16-bit Application)

8. SQL7:sp_processmail

9. (16bit Application) ODBC Problem with Access 7.0 Data Sources

10. Select Data Source locks my application

11. Data Source Problem for ADO Application

12. how can i insert a Data Source Name from my application to the

13. ODBC Problem with Access 7.0 Data Sources (16-bit Application - C/C++)