Solved

how to connect to a remote sql server...

Posted on 2000-04-30
5
224 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 5 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

828 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