J
Jimakos Bilakis
Hi guys!
I'm using the C++ Builder 6 Enterprise Edition where I create some
tables in Paradox and with the help of a structure i pass my data from
the form (Edit boxes) to the Paradox table with a speedbutton. (I am
also using several data modules where i keep all my tables and
queries).
First of all i need some "mechanism" to read the data from the tables
and also to be able to change these already stored values. I tried with
some DBEdit boxes...but it didn't work. It seems that at run time, when
i press Enter, the value that the user enters pass to the table without
letting me check the validity of user's values.
Is there any way to fix that?
If not, i thought of a way with a structure.
In the data module, in the header sheet ("project name".h) i have
(right down the public the struct:
struct PinSynt
{
int SyntAA;
AnsiString SyntKathg;
AnsiString SyntAKK;
float SyntSynt;
AnsiString SyntParat;
};
I'm trying to create a function that it will return whole structure. If
i do that, i'll replace the DBedits with Edits, as i'll pass the values
of my fields in the edits (as they do now with the DBedits).
Just below my struct, I'm writing:
struct PinSynt FunctionRead (int SyntAAKey); // where SyntAAKey =
Primary key
I compile the code, evething's ok. (Build All)
Now in the *.cpp sheet, i'm trying to write:
struct PinSynt TDM_Pinakas_Syntelestvn::FunctionRead (int SyntAAKey);
// where DM_Pinakas_Syntelestvn -> the name of my Data module.
{
struct PinSynt Help; // another struct of the same type for
help.
Query1->Close();
Query1->SQL->Clear();
// * SQL statements*//
//------------------------------//
// some code with if and other statements....//
return Help; // Help = whole structure.
}
Now if i compile the code...an error will occur:
'TDM_Pinakas_Syntelestvn::FunctionRead(int)' is not a member of
'TDM_Pinakas_Syntelestvn'
I'm trying again this way:
struct TDM_Pinakas_Syntelestvn:inSynt FunctionRead (int SyntAAKey);
// where DM_Pinakas_Syntelestvn -> the name of my Data module.
{
struct PinSynt Help; // another struct for help.
Query1->Close();
Query1->SQL->Clear();
// * SQL statements*//
//------------------------------//
// some code with if and other statements....//
return Help;
}
Now several errors occur:
- Undefined structure 'PinSynt'
- Size of 'StructRead' is unknown or zero
- Undefined symbol 'Query1'
- and every single variable that has to do with my struct PinSynt (i.e.
Help.SyntAA, Help.SyntKathg etc.)
i tried several times but nothing so far. My last try was:
//-------- .h sheet ----------//
PinSynt FunctionRead (int SyntAAKey); // where SyntAAKey = Primary key
//-------- .cpp sheet ---------//
PinSynt TDM_Pinakas_Syntelestvn::FunctionRead (int SyntAAKey);
// or TDM_Pinakas_Syntelestvn:inSynt FunctionRead (int SyntAAKey);
// or PinSynt FunctionRead (int SyntAAKey);
// it's always the same error!!! ===> Declaration syntax error
{
// the same code
}
I would be grateful if you could write a few lines of code so that i
could understand how i can create a function that returns a whole
structure.
Thanks in advance and please forgive my English..
I'm using the C++ Builder 6 Enterprise Edition where I create some
tables in Paradox and with the help of a structure i pass my data from
the form (Edit boxes) to the Paradox table with a speedbutton. (I am
also using several data modules where i keep all my tables and
queries).
First of all i need some "mechanism" to read the data from the tables
and also to be able to change these already stored values. I tried with
some DBEdit boxes...but it didn't work. It seems that at run time, when
i press Enter, the value that the user enters pass to the table without
letting me check the validity of user's values.
Is there any way to fix that?
If not, i thought of a way with a structure.
In the data module, in the header sheet ("project name".h) i have
(right down the public the struct:
struct PinSynt
{
int SyntAA;
AnsiString SyntKathg;
AnsiString SyntAKK;
float SyntSynt;
AnsiString SyntParat;
};
I'm trying to create a function that it will return whole structure. If
i do that, i'll replace the DBedits with Edits, as i'll pass the values
of my fields in the edits (as they do now with the DBedits).
Just below my struct, I'm writing:
struct PinSynt FunctionRead (int SyntAAKey); // where SyntAAKey =
Primary key
I compile the code, evething's ok. (Build All)
Now in the *.cpp sheet, i'm trying to write:
struct PinSynt TDM_Pinakas_Syntelestvn::FunctionRead (int SyntAAKey);
// where DM_Pinakas_Syntelestvn -> the name of my Data module.
{
struct PinSynt Help; // another struct of the same type for
help.
Query1->Close();
Query1->SQL->Clear();
// * SQL statements*//
//------------------------------//
// some code with if and other statements....//
return Help; // Help = whole structure.
}
Now if i compile the code...an error will occur:
'TDM_Pinakas_Syntelestvn::FunctionRead(int)' is not a member of
'TDM_Pinakas_Syntelestvn'
I'm trying again this way:
struct TDM_Pinakas_Syntelestvn:inSynt FunctionRead (int SyntAAKey);
// where DM_Pinakas_Syntelestvn -> the name of my Data module.
{
struct PinSynt Help; // another struct for help.
Query1->Close();
Query1->SQL->Clear();
// * SQL statements*//
//------------------------------//
// some code with if and other statements....//
return Help;
}
Now several errors occur:
- Undefined structure 'PinSynt'
- Size of 'StructRead' is unknown or zero
- Undefined symbol 'Query1'
- and every single variable that has to do with my struct PinSynt (i.e.
Help.SyntAA, Help.SyntKathg etc.)
i tried several times but nothing so far. My last try was:
//-------- .h sheet ----------//
PinSynt FunctionRead (int SyntAAKey); // where SyntAAKey = Primary key
//-------- .cpp sheet ---------//
PinSynt TDM_Pinakas_Syntelestvn::FunctionRead (int SyntAAKey);
// or TDM_Pinakas_Syntelestvn:inSynt FunctionRead (int SyntAAKey);
// or PinSynt FunctionRead (int SyntAAKey);
// it's always the same error!!! ===> Declaration syntax error
{
// the same code
}
I would be grateful if you could write a few lines of code so that i
could understand how i can create a function that returns a whole
structure.
Thanks in advance and please forgive my English..