thebestdave76
asked on
CRecordset::Addnew
Hi,
I've got a database named "baseref". In this DB there is a table Named "MERSENNE". In this Table there is a column named "Simu1". I'd like to add a record in the table "MERSENNE" so I wrote this program :
CAleatoire::CAleatoire(CDa tabase *baseRef)
{
CString Test;
CString Champ;
CRecordset RecDonnees(baseRef);
Champ="Simu1";
Test="ee";
RecDonnees.Open(CRecordset ::dynaset, "SELECT * FROM MERSENNE");
RecDonnees.AddNew();
RecDonnees(Champ)=Test;
RecDonnees.Update();
}
When I compile this program, the line "RecDonnees(Champ)=Test" is on error :
error C2064: term does not evaluate to a function
What have I have to do to add a record to my table "MERSENNE"?
I've got a database named "baseref". In this DB there is a table Named "MERSENNE". In this Table there is a column named "Simu1". I'd like to add a record in the table "MERSENNE" so I wrote this program :
CAleatoire::CAleatoire(CDa
{
CString Test;
CString Champ;
CRecordset RecDonnees(baseRef);
Champ="Simu1";
Test="ee";
RecDonnees.Open(CRecordset
RecDonnees.AddNew();
RecDonnees(Champ)=Test;
RecDonnees.Update();
}
When I compile this program, the line "RecDonnees(Champ)=Test" is on error :
error C2064: term does not evaluate to a function
What have I have to do to add a record to my table "MERSENNE"?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I tried RecDonnees.Champ=Test;
I had this message :
error C2039: 'Champ' : is not a member of 'CRecordset'
I had this message :
error C2039: 'Champ' : is not a member of 'CRecordset'
ASKER
To rajeev_devin :
I checked your link but I have had the same error when I wrote "StrCopy(RecDonnees("Simu1 "), "ee");"
What can I do to insert a new record?
I checked your link but I have had the same error when I wrote "StrCopy(RecDonnees("Simu1
What can I do to insert a new record?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I tried the alternative ADO but there is a lot of errors on msjro.tlh during the compilation.
I don't have the class Wizard on my Visual C++, it is disabled.
How can I do to select the table I want as part of my new class?
I don't have the class Wizard on my Visual C++, it is disabled.
How can I do to select the table I want as part of my new class?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
you can do like :
RecDonnees.AddNew();
RecDonnees.Champ=Test;
RecDonnees.Update();
MAHESH