Re: insert into text data
Posted in 2004
?L???V wrote: > Our ASP program is listed below, which insert data into informix text > field (c1 is char, c2 is text data type). It works but something > strange when I try to query the data through isql tool. > The c2 filed is "21" not "2", and I can't query the data by isql's > form utility. It must use sql command select * from t1 where c1="11". > > <% > set conn = server.createobject("adodb.connection") > conn.open #dsn#, #uid#, #pwd# > v_c1 = "11" > v_c2 = "2" > sql = "insert into t1(c1, c2)" & _ > " values ('" & v_c1 & "','" & v_c2 & "')" > conn.execute sql > %> The basic problem you are facing is that Informix does not support character strings as TEXT literals. You have to pass it as a placeholder - or your ADO driver system has to do it for you. The details of that are something else - I've no idea what you have to do. But the gist will be: sql = "insert into t1(c1, c2) values(?, ?)"; and then you learn how to pass your two values -- v_c1 and v_c2 -- to an SQL statement as it is executed. Alternatively, don't use TEXT in Informix. Given that in a follow-up posting you mentioned IDS 7.31, you are stuck with just VARCHAR for values up to 255 characters long, or CHAR for longer strings (without any space saving). Of upgrade to IDS 9.40, where you can use LVARCHAR up to 32 KB (minus a bit). -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/