Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC + ADO + Delphi and Data Truncated for column 'xxx'

Status
Not open for further replies.

xor2

Programmer
Mar 24, 2005
22
Hi,
I have downloaded odbc driver 3.51 v, installed it and configure in Control Panel/Administrative Tools/Odbc Source.
I have successfully connected in delphi through ADO and the problem is with SQL - insert - statement.

I have a field: 'Percent' float NOT NULL.

These lines, I use to insert data:

adoMySQL.sql.clear;
adoMySQL.sql.add ('insert into sth values:)p1, :p2, :p3, :p4, :p5 ); ');

Parameters from p1 to p4 ....
adoMySQL.Parameters.ParamByName ('p5').Value := 4.5;
adoMySQL.ExecSQL;

it fails on last one (real type Field) with error:
Data truncated for column 'Percent' on line 1 ...
However if i try to execute this sql straight in my Mysql Manager program
it works good ....


Please help, what is wrong ??

Thank you for any help
 

A couple of things to try:

1. Try it without the trailing semi-colon.

2. Specify a column list. You should always do this anyway. If anyone adds a new column to the table, the code will break:
[tt]
insert into sth (f1,f2,f3,f4,f5) values :)p1,:p2,:p3,:p4,:p5 )
[/tt]
 
Hi
Thank you for your replay.
Unforntunately, none of your advice helped me.
I have still same problem :(((

Please help me do sth ... :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top