|
Hi
Can anybody help me solve the following problem I have.
I have the following code in my header file:
class CSQLConnection;
class SQLDocument
{
.....
private:
CSQLConnection* m_DatabaseConnection;
};
in my source file I have the following code:
#include header file
#include "SQLCOnnection.h"
m_DatabaseConnection = new CSQLConnection;
The constructor for the CSQLConnection class has been declared as public and takes no arguments.
However I get the following error message:
Kein geeigneter Standardkonstruktor verfuegbar
which I read as from the help files as saying that the is no available standard constructor for the given class.
Anybody Help!!!
|
|
|
|
|
FranzKlein wrote:
m_DatabaseConnection = new CSQLConnection;
Are you trying to instantiate a private member of SQLDocument outside the class?
That's wrong wrong wrong....
Cut that line and paste it into the SQLDocument constructor.
FranzKlein wrote:
Kein geeigneter Standardkonstruktor verfuegbar
Yes, I like my moms food too!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
I am instantiating the private member m_DatabaseConnection inside the source file for SQLDocument.
I have also tried copying that line to inside the SQLDocument constructor but I still get the same error message.
|
|
|
|
|
Are you running VC++?
Compile, cut n' paste the error message here in a new message so I know exactly what error it is!
You can try add a constructor yourself if you hasn't.
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
I am using VC6 SP5 Professional Edition (German).
Here is the error message:;P
error C2512: 'CSQLServerConnection' : Kein geeigneter Standardkonstruktor verfuegbar
So basically in CSQLDocument.h I have written
class CSQLServerConnection;
class CSQLDocument
{
....
private:
CSQLServerConnection* m_DatabaseConnection;
};
In CSQLDocument.cpp I have written:
CSQLDocument::CSQLDocument()
{
m_DatabaseConnection = new CSQLServerConnection;
}
In the CSQLServerConnection class file there is a standard constructor.
|
|
|
|
|
FranzKlein wrote:
I am using VC6 SP5 Professional Edition (German).
Here is the error message
I thought the English edition was the only one.
Well my friend, I tried a similar code and I got C2512 too!
I would call it a bug but I'm not a C++ expert!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
What does the CSQLConnection class look like?
|
|
|
|
|
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
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_)
|
|
|
|
|
Yes, but what about the CSQLConnection class?
|
|
|
|
|
I renamed the CSQLConnection class to CSQLServerConnection. All other references to CSQLConnection have also been changed to CSQLServerConnection. I think the problem might lie with me using the Halcon Imaging Library (www.mvtec.com).
So in the Document class header file (SQLDocument.h) I have:
class SQLDocument
{
.....
private: CSQLServerConnection* m_DatabaseConnection;
};
and in the implementation file (SQLDocument.cpp) I have:
#include "SQLDocument.h"
#include "SQLServerConnection.h"
<p>
SQLDocument::SQLDOcument()
{
m_DatabaseConnection = new CSQLServerConnection;
}
On my other computer I have swapped the #include statements around in the implementation file:
#include "SQLServerConnection.h"
#include "SQLDocument.h"
Now I don't get any error messages, but then I am not using the Halcon Imaging Library.
|
|
|
|
|
Say we have this Matlab piece of code
nr_of_samples = 10000;
y(1:nr_of_samples) = y_long(1:nr_of_samples);
samplingtime = 1/52e6;
for i=1:nr_of_samples
t(i) = (samplingtime)*i;
end;
I would like to rewrite such a code in VC++. How do I proceed?
Plz do not advise me to use Matlab compiler!
Thx
F.K
|
|
|
|
|
well i could probably help you out a bit but i don't know Matlab. What does this mean in plain english:
flora_k wrote:
y(1:nr_of_samples) = y_long(1:nr_of_samples);
And what is t(i)? Is that some form of plot? If you just want values for a calculation the bulk of the code would look something like:
int nNrOfSamples = 10000;
float fSampling = .00000001923;
float t[ 10000 ];
for( int i = 0; i < nNrOfSamples; i++ )
t[ i ] = fSampling * i;
The above will store your values in an array t. If you are actually looking to plot those values on a graph you have a lot of work ahead of you unless you decide to buy a commerical ( or find a free ) charting package. If you let me know what that one line means i should be able to tell you how to convert it.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Try this:
flora_k wrote:
nr_of_samples = 10000
int nrOfSamples=10000;
flora_k wrote:
y(1:nr_of_samples) = y_long(1:nr_of_samples);
for(int i=0;i<nrOfSamples;i++)
{
y[i]=ylong[i];//you have to declare what type of arrays are y and ylong
}
flora_k wrote:
samplingtime = 1/52e6;
float fSamplingTime = .00000001923;
flora_k wrote:
for i=1:nr_of_samples
t(i) = (samplingtime)*i;//you have to declare the type of array of t
end;
for(i=0;i<nrOfSamples;i++)
{
t[i]=fSamplingTime*i;
}
cheers
Daniel Cespedes Daza
"Santa Cruz de la Sierra Paraiso Terrenal!"
daniel.cespedes@ieee.org
|
|
|
|
|
Hi,
I need to send some data from one application to another(MFC).can anybody tell me what is the best way to do it.I may need to invoke a function of one application from another,or i may use any other method to send a buffer across apllication.
Can anybody help me regarding this.
I badly need it.
|
|
|
|
|
Window messages?
Define your custom message and handle it in your app. Use SendMessage() to send your data!
Rickard Andersson8
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Thanks Rickard,where can i get the info regarding custom masseges.I am a begginer.
|
|
|
|
|
You can use memory mapped-files perhaps ?
This is a file that is mapped into memory and you can put data in it. You can use a pointer on it to retrieve data !
Take a look at the MSDN documentation (CreateFileMapping, MapViewOfFile, ..)
Hope this helps
|
|
|
|
|
Hi ,
Thanks a lot for suggestion.
Can you please tell me where i can get a good tutorial on this.
|
|
|
|
|
Sorry, no. I don't know any tutorial.
What I can do is perhaps send some code files but it's just some separate files so I don't think it will help you very much.
Can you give me your e-mail adress?
Ced
|
|
|
|
|
I don't know it's good enough?
can anyone sell it;about 300$
Audio chat web server,coded by C++,can run on windows/liunx
ease to install and use.very good audio quality.
|
|
|
|
|
Hi all ,
Can we subclass scrollbar control of editbox, combobox, listbox... in MFC?
How to do it? Please help me!
Thanks alot
|
|
|
|
|
It's no answer, isn't it ?
So boring
|
|
|
|
|
how do i set the font and color of individual controls in an mfc dialog box.
also can i set the foreground color of a CButton.
can someone post some code.
rIsHaBH
|
|
|
|
|
The message you need to handle is different depending on what control you need to override. You should look at the WM_CTRLCOLOR(x) messages. For a button the WM_CTLCOLORBTN would be sent to your dialog ( parent window ) when before the button is drawn. This will allow you to set the foreground color of the dlg. The others are located here:
WM_CTLCOLORBTN[^]
WM_CTLCOLORDLG[^]
WM_CTLCOLOREDIT[^]
WM_CTLCOLORLISTBOX[^]
WM_CTLCOLORSCROLLBAR[^]
WM_CTLCOLORSTATIC[^]
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Any advice as to which is a good way to add CD data burning capabilities to an app ? Anyone here have any experiences with an SDK or Control?
I think if I could stick to XP that I could use the Image Mastering API, unfortunately not all users have XP yet.
Regardz
Colin J Davies
* WARNING * Save your work This link is to reboot your PC
It's a real shame that people as stupid as you can work out how to use a computer. said by Christian Graus in the Soapbox
|
|
|
|