No title

Started by Mohsen Pahlevanzadehabout 21 years ago2 messagesgeneral
Jump to latest
#1Mohsen Pahlevanzadeh
mohsen@pahlevanzadeh.org

Dears,
When i wanna insert to my following code,I receive following error:
Insert into c(t) values('ccccccc'); --> It's my qurey.
Insert command failed!So i can't continue to insert in your table!
ERROR: pg_atoi: error in "ccccccc": can't parse "ccccccc"

my code :
pres = PQexec(pobj->connection2db, ins.c_str());
ins="";
if (!pres || PQresultStatus(pres) != PGRES_COMMAND_OK)
{
fprintf(stderr, "Insert command failed!So i can't continue to insert
in your table!\n");
cout << PQerrorMessage(pobj->connection2db);
pobj->exit_nicely(pobj->connection2db);
}
PQclear(pres);

When i print ins.c_str(),I see following statement:
Insert into z(e) values('10z');
It's true,But i recieve same error.
Please help me..............
--Mohsen

#2Miroslav Šulc
miroslav.sulc@startnet.cz
In reply to: Mohsen Pahlevanzadeh (#1)
Re:

Mohsen Pahlevanzadeh wrote:

Dears,
When i wanna insert to my following code,I receive following error:
Insert into c(t) values('ccccccc'); --> It's my qurey.
Insert command failed!So i can't continue to insert in your table!
ERROR: pg_atoi: error in "ccccccc": can't parse "ccccccc"

Usually atoi functions perform conversion from string to integer (if my
memory serves well). Maybe the problem is that you are trying to insert
string into numeric field.

...

Miroslav