Multiple Statement.execute calls truncate data

Please post support and help requests here.
DougE
Posts: 9
Joined: 17 Feb 2009, 17:43

Multiple Statement.execute calls truncate data

Postby DougE » 17 Feb 2009, 19:12

I am trying to create a table and insert some simple data. I executed the following code and it created the table and inserted the first record fine. However, the data in the second record was truncated to the size of the data from the first call. I'm using ODBC on Windows writing to an Access DB.

Code: Select all

session << "CREATE TABLE Property ( \
   kPropertyID COUNTER (1, 1), \
   sProperty VARCHAR(50) NOT NULL, \
   sValue VARCHAR(50) NOT NULL, \
   CONSTRAINT pk_options PRIMARY KEY (kPropertyID), \
   CONSTRAINT idx_id UNIQUE (sProperty) \
)", now;

string property;
string value;

Statement insertStmt(session);
insertStmt << "INSERT INTO Property (sProperty, sValue) VALUES(?, ?)", use(property), use(value);

// Group 1
property = "Name";
value = "MasterDb";
insertStmt.execute();

// Group 2
property = "Version";
value = "2.0.2";
insertStmt.execute();


If I run in the order shown above Group 1 first, then the value of sProperty in the second record will be "Vers", the size of "Name". If I execute Group 2 first then the value of sValue in the second record will be "Maste", the size of "2.0.2".

Can you help me out?

Thanks in advance!

Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests