Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to connect to a remote sql server...

Posted on 2000-04-30
5
Medium Priority
?
249 Views
Last Modified: 2010-04-02
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 ;(
0
Comment
Question by:beyonddeath
  • 3
  • 2
5 Comments
 

Expert Comment

by:jonasb
ID: 2765706
m_pDB = new CDatabase;

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

Accepted Solution

by:
jonasb earned 20 total points
ID: 2765726
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
 

Author Comment

by:beyonddeath
ID: 2766286
does the all work in a console app (im makeing it cgi) Thanks for the help ;)
0
 

Expert Comment

by:jonasb
ID: 2766576
My plesure.. Thanx for the 5 :)
0
 

Author Comment

by:beyonddeath
ID: 2766965
this does work in console mode right

np for the points heeh sorry its not more i dont have ne to give ;)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question