Ok so I have an executable which launches my batch file and the batch file then should create an ODBC data source to my SQL server. If I run the batch file by itself it runs perfectly and creates the data source, but when I run it through my exe it runs, returns no errors but doesn’t create the data source.
my entire exe code is
#include <windows.h>
#include <iostream>
#include <dos.h>
#include <conio.h>
using namespace std;
int main ( int argc, char *argv[] )
{
cout << system("find2.bat");
system("PAUSE");
return 0;
}
and my batch command is
ODBCCONF.exe CONFIGSYSDSN "SQL Server" "DSN=test_DSN | Description=test Data Source | SERVER=(local) | Trusted_Connection=Yes"
I also tried to output any errors from the batch file but it just created a blank text file so I guess no errors.
So does anybody have any ideas what could be causing this?
Are you sure the batch file is running? Since you’re not building an absolute path, I would guess it’s not being found.