how to connect to a remote sql server...

I need access to a msql server on remote systems that will access tables and edit them. If this is possible can you show me how and possibly some sample code sorry i only have 5 points ;(
beyonddeathAsked:
Who is Participating?
 
jonasbConnect With a Mentor Commented:
Hi
U need to generate a table class for the table U want to change. Easly done with visual studio, just "add class" and inherit from CRecordset. Tell VS the ODBC name and voila..

//h file:

CDatabase* m_pDB
CYourTableClass* m_pTable;

//cpp file:

m_pDB = new CDatabase;
//TRy to connact to DB
if(!m_pDB->Open("Name of ODBCSource"))       {
   return(FALSE); //Error
}            

m_pTable = new CYourTableClass(m_pDB);
if(m_pTable== NULL) return(FALSE);
m_pTable->YourFunction();

That should do it..
0
 
jonasbCommented:
m_pDB = new CDatabase;

//TRy to connact to DB
if(!m_pDB->Open("Name of ODBCSource))       {
return(FALSE); //Error]
}            
0
 
beyonddeathAuthor Commented:
does the all work in a console app (im makeing it cgi) Thanks for the help ;)
0
 
jonasbCommented:
My plesure.. Thanx for the 5 :)
0
 
beyonddeathAuthor Commented:
this does work in console mode right

np for the points heeh sorry its not more i dont have ne to give ;)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.