Click here to Skip to main content
16,005,121 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSolving an error message Pin
Franz Klein20-May-03 22:01
Franz Klein20-May-03 22:01 
GeneralRe: Solving an error message Pin
Rickard Andersson2020-May-03 23:07
Rickard Andersson2020-May-03 23:07 
GeneralRe: Solving an error message Pin
Franz Klein20-May-03 23:40
Franz Klein20-May-03 23:40 
GeneralRe: Solving an error message Pin
Rickard Andersson2021-May-03 1:00
Rickard Andersson2021-May-03 1:00 
GeneralRe: Solving an error message Pin
Franz Klein21-May-03 1:17
Franz Klein21-May-03 1:17 
GeneralRe: Solving an error message Pin
Rickard Andersson2021-May-03 2:27
Rickard Andersson2021-May-03 2:27 
GeneralRe: Solving an error message Pin
David Crow21-May-03 2:54
David Crow21-May-03 2:54 
GeneralRe: Solving an error message Pin
Franz Klein21-May-03 3:25
Franz Klein21-May-03 3:25 
Here are the contents of the .cpp file for the CSQLServerConnection class
#include "stdafx.h"
#include "SQLServerConnection.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Konstruktion/Destruktion
//////////////////////////////////////////////////////////////////////

CSQLServerConnection::CSQLServerConnection()
{

}

CSQLServerConnection::~CSQLServerConnection()
{

}

bool CSQLServerConnection::Connect(string database, string host, string user, string password)
{
	server_connection = new Connection(database.c_str(), host.c_str(), user.c_str(), password.c_str());
	return true;
}

bool CSQLServerConnection::SQLQuery(string query, string& error_message)
{
	try
	{
		Query thequery = server_connection->query();
		thequery << query;
	}
	catch (BadQuery error)
	{
		error_message = error.error;
		return false;
	}
	return true;
}


Here are the contents of the .h file for the CSQLServerConnection file:
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SQLSERVERCONNECTION_H__72EDA6F0_B4A2_4B36_8353_222CCFB751AB__INCLUDED_)
#define AFX_SQLSERVERCONNECTION_H__72EDA6F0_B4A2_4B36_8353_222CCFB751AB__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>
#include <mysql++>

using namespace std;

class CSQLServerConnection  
{
public:
	CSQLServerConnection();
	virtual ~CSQLServerConnection();

	bool Connect(string database, string host, string user, string password);
	bool SQLQuery(string query, string& error_message);

private:
	string database_name;
	string user_name;
	string query_text;
	Connection* server_connection;
	Result query_result;
};

#endif // !defined(AFX_SQLSERVERCONNECTION_H__72EDA6F0_B4A2_4B36_8353_222CCFB751AB__INCLUDED_)


Smile | :)
GeneralRe: Solving an error message Pin
David Crow21-May-03 4:03
David Crow21-May-03 4:03 
GeneralRe: Solving an error message Pin
Franz Klein21-May-03 21:34
Franz Klein21-May-03 21:34 
GeneralSampling Pin
flora_k20-May-03 21:58
flora_k20-May-03 21:58 
GeneralRe: Sampling Pin
Joseph Dempsey21-May-03 1:32
Joseph Dempsey21-May-03 1:32 
GeneralRe: Sampling Pin
Cambalindo21-May-03 2:57
Cambalindo21-May-03 2:57 
GeneralPlease help!communication between 2 applications. Pin
vcseeker20-May-03 21:53
vcseeker20-May-03 21:53 
GeneralRe: Please help!communication between 2 applications. Pin
Rickard Andersson2020-May-03 23:02
Rickard Andersson2020-May-03 23:02 
GeneralRe: Please help!communication between 2 applications. Pin
vcseeker22-May-03 1:06
vcseeker22-May-03 1:06 
GeneralRe: Please help!communication between 2 applications. Pin
Cedric Moonen20-May-03 23:06
Cedric Moonen20-May-03 23:06 
GeneralRe: Please help!communication between 2 applications. Pin
vcseeker22-May-03 1:03
vcseeker22-May-03 1:03 
GeneralRe: Please help!communication between 2 applications. Pin
Cedric Moonen22-May-03 1:14
Cedric Moonen22-May-03 1:14 
QuestionAudio chat web server,Five months hard work,good enough? Pin
ycjmail@21cn.com20-May-03 21:05
ycjmail@21cn.com20-May-03 21:05 
QuestionHow to replace scrollbar? Pin
zuken2120-May-03 21:01
zuken2120-May-03 21:01 
AnswerRe: How to replace scrollbar? Pin
zuken2122-May-03 23:16
zuken2122-May-03 23:16 
Generalsetting fonts and color Pin
r i s h a b h s20-May-03 18:06
r i s h a b h s20-May-03 18:06 
GeneralRe: setting fonts and color Pin
Joseph Dempsey21-May-03 1:23
Joseph Dempsey21-May-03 1:23 
GeneralBurn CD Data Pin
ColinDavies20-May-03 15:58
ColinDavies20-May-03 15:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.