Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to a DSN

Status
Not open for further replies.

jl3574

Programmer
Jun 5, 2003
76
CA
i'm creating an application which connects to a local sql server
however the dsn string is hardcoded into my program.

char ConnectionString[10]="DSN=local";
CDatabase* theDb = new CDatabase;
CRecordset* theRec = new CRecordset(theDb);
theDb->OpenEx(ConnectionString);
...............
...............
theDb->Close();


i want the program to be used by other user that is connected to my server i want the program to open a prompt asking the user to enter the dsn b4 the app starts and they can locate my dsn thru the network....
how is this done?

 
You add a dialog to the application with edit boxes etc., for the user to enter the information you need. Then you show the dialog and collect the information. Then you use the information to build the connection string.

Is that what you mean?


-pete
 
acutally i found a built in function in the CDatabase class
CDatabase::forceOdbcDialog
this will automatically force a dialog box to locate purposely a DSN file. so this works
:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top