BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using database object as pointer in external file

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop)
View previous topic :: View next topic  
Author Message
Mike
Guest





PostPosted: Sun Dec 21, 2003 12:34 pm    Post subject: using database object as pointer in external file Reply with quote



Hi,

i am working on an application which use three mysql database. i program
with bcb 5 enterprise. As I will very often connect to these databases I
like to write my own function, which can be used from anywhere and for any
database.

I have following vision:

I have anywhere one of few TmySQLDatabase objects. Now, I call a function,
which I give the adress of that TmySQLDatabase object and second parameter
determine the database. Exmaple:

DBConnect(&SQLDatabase,"db1");

The function has the task to build a connection to that object and give it
back, so that my application may work with it.


I have created to files:

database.cpp

#include "database.h"
// connect with database
bool __fastcall DBConnect(TmySQLDatabase *database, String db)
{
return true;
}

and

database.h

#include <vcl.h>
// connect with databse
bool __fastcall DBConnect(TmySQLDatabase *database, String db);


Now I add the CPP fiel to my project and include the header file.

After compiling, i get these errors:

[C++ Fehler] DATABASE.H(7): E2147 Parameterdeklaration darf nicht mit
'TmySQLDatabase' beginnen.
[C++ Fehler] database.cpp(Cool: E2147 Parameterdeklaration darf nicht mit
'TmySQLDatabase' beginnen.

Translate to english, it should be like:

[C++ Error] DATABASE.H(7): E2147 parameter declaration may not start with
'TmySQLDatabase'.
[C++ Error] database.cpp(Cool: E2147 parameter declaration may not start with
'TmySQLDatabase'.


Now I tried to add this line in the Header file:

#include "mySQLDbTables.hpp"

This error appears:

[C++ Warnung] Math.hpp(76): W8058 Präcompilierter Header: Initialisierte
Daten im Header kann nicht erzeugt werden.

in english:

[C++ Error] Math.hpp(76): W8058 prae compiled header: Initialize data in
header cannot be generated.

My CPP file and H file stay in parallel folders to my project, if this is
important for you.

I hope you could unterstand and help me.

Mike





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.