
September 23rd, 2003, 05:22 PM
|
|
Junior Member
|
|
Join Date: Sep 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Data source name not found and no default dr
Hello,
I am trying to copy the tables from MSaccess database to other database given the source database DSn name(ex:AccountInfo) and the destination database DSN name(GPSMData1).
In the following code I have hard coded dest DSN name to be GPSMData1. also, for testing purpose my destination database is also mdb file.
CDatabase db;
b.OpenEx("DSN="+ srcDSNname);
CString sql = "SELECT accounts.* INTO[ODBC;DSN='GPSMData1';UID='Admin';PWD=].accounts FROM accounts;" ;
db.ExecuteSQL (sql) ;
db.Close();
I have no problem connecting to src DSN when I use MFC's CDatabase class function OpenEx("DSN="+ srcDSNname). But got following error message displayed in log at ExecuteSQL():
[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
I pasted the above sql query in my src database, Account.mdb, i got the same error. just for the heck for it, I went to my destination database GPSMdata.mdb, and rearranged my SQl such that:
SELECT accounts.* INTO accounts FROM [ODBC;DSN='AccountInfo';UID='Admin';PWD=].accounts;"
again the same error as above.... seems okay to connect via MFC's CDatabase but not via this query....
Please help ....................
thx...
|