Received: from u1.abs.net (root@u1.abs.net [207.114.0.131]) by hub.org (8.9.2/8.9.1) with ESMTP id JAA71719 for ; Fri, 19 Mar 1999 09:30:39 -0500 (EST) (envelope-from byronn@insightdist.com) Received: from insightdist.com (nobody@localhost) by u1.abs.net (8.9.0/8.9.0) with UUCP id JAA09874 for pgsql-interfaces@postgreSQL.org; Fri, 19 Mar 1999 09:21:41 -0500 (EST) X-Authentication-Warning: u1.abs.net: nobody set sender to insightdist.com!byronn using -f Received: from ceodev by insightdist.com (AIX 3.2/UCB 5.64/4.03) id AA35545; Fri, 19 Mar 1999 09:09:08 -0500 Received: from byronn by ceodev (AIX 4.1/UCB 5.64/4.03) id AA79084; Fri, 19 Mar 1999 09:09:07 -0500 Message-Id: <36F25C36.B237BCCF@insightdist.com> Date: Fri, 19 Mar 1999 09:16:22 -0500 From: Byron Nikolaidis X-Mailer: Mozilla 4.05 [en] (Win95; I) Mime-Version: 1.0 To: Peter Andrews Cc: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] ODBC string insert problem References: <36F17273.D1ABBC98@piedmontdata.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Peter Andrews wrote: > I am unable to insert the following string: > > 40'S? > > into a varchar field through my ODBC driver. The statement: > > insert into test values('40\'S?'); > A Question Mark is reserved as a parameter marker in odbc. The best way to do something like this is to actually use a parameter. Then the driver will allow question marks and other things. It will also translate things this way, such as single quotes and so forth. So, the moral of the story is, anytime you need to insert anything other than very simple data, use a parameter. The above example would become something like: strcpy(buf, "40'S?") pcbValue = strlen(buf) SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, 0, 0, buf, sizeof(buf), &pcbValue) SQLExecDirect(hstmt, "insert into test values (?)", SQL_NTS) Byron