[unixODBC-support] Updating values using parameters

Ian Ashley iashley at picdar.com
Mon Oct 4 14:51:18 BST 2004


I am having a problem trying to use a parameter to update column in a table.
Use the following code fragment

/* P_LONGTEXT is a TEXT column
 * although I cannot get it to work on an INTEGER column either
 */

SQLPrepare(stmtHandle, ³UPDATE P_SIMPLE SET P_LONGTEXT = ? WHERE P__URN =
1²);
SQLBindParameter(stmtHandle, 1, SQL_PARAM_INPUT, SQL_C_CHAR,
SQL_LONGVARCHAR, length, 0, theValue, 0, NULL);
SQLExecute(stmtHandle);

I am using FreeTDS to talk to a Sequel Server.

I have tried various other solutions including using WRITETEXT but cannot
get any one to work. When I use the commands

DECLARE @ptrval VARBINARY(16)
SELECT @ptrval = TEXTPTR(P_LONGTEXT) FROM P_SIMPLE WHERE P__URN = 1

I get an error that @ptrval isn't defined. I get this if I use iSQL as well
as from my code.

Any solution where the text doesn't have to be included directly in the SQL
will suffice.

Cheers,
Ian





More information about the unixODBC-support mailing list