Solved

how to connect to a remote sql server...

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now