Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3A0D147611D for ; Wed, 27 Nov 2002 01:19:25 -0500 (EST) Received: from vip.sina.com (unknown [202.108.35.183]) by postgresql.org (Postfix) with SMTP id 756184760EF for ; Wed, 27 Nov 2002 01:19:18 -0500 (EST) Received: (qmail 79870 invoked from network); 27 Nov 2002 06:19:10 -0000 Received: from unknown (HELO zh) (218.108.232.5) by 202.108.35.183 with SMTP; 27 Nov 2002 06:19:10 -0000 From: "Han" To: pgsql-odbc@postgresql.org Subject: Problem about Bytea and SQL_C_CHAR X-mailer: Foxmail 4.2 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="GB2312" Content-Transfer-Encoding: quoted-printable Date: Wed, 27 Nov 2002 14:19:37 +0800 Message-Id: <20021127061918.756184760EF@postgresql.org> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200211/162 X-Sequence-Number: 2339 Hi, Here is the code: strcpy(data, "FF"); cb =3D 2; rc =3D SQLBindParameter(hstmt, i, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARBINARY, precision, scale, &data, MAX_STRING_SIZE, &cb); rc =3D SQLPrepare(hstmt, "insert into test(ColBytea) values(?)", SQL_NTS); rc =3D SQLExecute(hstmt); =09 After this, the value inserted in column ColByteatable(datatype is bytea) = of table test was a char string 'FF', which was expected to be 0xFF(255). =09 There's no problem with binary column in Ms Sql Server. I'm porting my cod= e from sql server to postgresql. So help me, please! Regards! =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1 =20=09=09=09=09 =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1Han =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1zhouhanok@vip.sina.com =A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A1=A12002-11-27