DSn Creation through SQLConfigDataSource() funciton
Database
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, The following sample failed to create the DSN, void main() { //As my DB path will change frequently i am using this method. bool aDSNCreated = false; char temp[MAX_PATH]; sprintf(temp,"DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"); aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver (*.mdb)\0", temp); printf("%d",aDSNCreated ); } whereas when I execute the below code; it execute successfully.Can anyone help in this why its happening? void main() { bool aDSNCreated = false; aDSNCreated = SQLConfigDataSource(NULL, ODBC_ADD_SYS_DSN, "Microsoft Access Driver(*.mdb)\0","DSN=SAMPLE\0DBQ=D:\\SAMPLE.mdb\0"); printf("%d",aDSNCreated ); }