Click to See Complete Forum and Search --> : How to INSERT record using ExecuteSQL() Function?


chinajiang
April 1st, 1999, 03:52 AM
I write a program such below:

....

CDatabase m_pDb;

m_pDb.Open("dbcontrol");

str="INSERT INTO renTable (Name,Number) VALUES ('yj',1001)";

m_pDb.ExecuteSQL(str);

....

note: renTable is a table

Name is a text field,Number is a numeric field

there is a wrong with the above program,the "insert" is unavailable,

but when

str="INSERT INTO renTable(Name) VALUES ('yj')";

m_pDb.ExecuteSQL(str);

it is available.

that is to say ,inserting "Numeric" type field have errors,also Date,Currency,etc type field except "Text"type field.

Why? How to resolve?


Thanks.