X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 38CEB3A43AE for ; Wed, 17 Nov 2004 21:53:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 29737-09 for ; Wed, 17 Nov 2004 21:52:55 +0000 (GMT) Received: from gk-us2.michelin.com (gk-us2.michelin.com [156.65.14.19]) by svr1.postgresql.org (Postfix) with ESMTP id B7C933A437D for ; Wed, 17 Nov 2004 21:52:55 +0000 (GMT) Received: from ONCMH1.onc.michelin.com (unverified) by gk-us2.michelin.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Wed, 17 Nov 2004 15:10:50 -0500 Received: from oncmtap1.onc.michelin.com by oncmh1.onc.michelin.com with ESMTP for pgsql-odbc@postgresql.org; Wed, 17 Nov 2004 15:13:12 -0500 Received: from oncems01.onc.michelin.com ([156.65.125.150]) by oncmtap1.onc.michelin.com (Netscape Messaging Server 4.15) with ESMTP id I7CB2000.0J4 for ; Wed, 17 Nov 2004 15:18:00 -0500 Received: from us.michelin.com (unverified) by oncems01.onc.michelin.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Wed, 17 Nov 2004 15:17:51 -0500 Message-Id: <419BB1ED.7050000@us.michelin.com> Date: Wed, 17 Nov 2004 15:17:49 -0500 From: "Greg Campbell" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ed Brown Cc: pgsql-odbc@postgresql.org Subject: Re: SQL Error- SQLBindColumn and TimeStamp Field References: <07d901c4ccd8$254b2360$fb04a8c0@arcHead.arcompanies.net> In-Reply-To: <07d901c4ccd8$254b2360$fb04a8c0@arcHead.arcompanies.net> Content-Type: multipart/mixed; boundary="------------090306050905030102020207" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/82 X-Sequence-Number: 4696 This is a multi-part message in MIME format. --------------090306050905030102020207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Please clarify "trying to insert a Timestamp field" Are you doing Data Definition -- creating a timestamp field or Data Manipulation -- populating data into an existing timestamp field. If data manipulation: I do not know Delphi, but couldn't you execute as query string against a connection -- a string like "INSERT INTO my_table (my_time) VALUES ('2004-11-17 12:10:35')"? and did you mean for the year value to be 200? Ed Brown wrote: > I have been trying to do an insert into a TimeStamp field in > Postgresql 7.34 (running on Suse 9.0, if it matters). The application > is in Delphi 7.0, but the code is similar enough that you C gurus > should be able to see what's happening. I get the text as a string, > parse it into the various elements, and populate the > SQL_TimeStamp_Structure. When I execute the SQLBindColumn function I > get the following message: > > Unable to Bind Parameter- State: S1003, Error # 0, > [Microsoft][ODBC Driver Manager] Program type out of range > > The values in the structure are reasonable, and other elements work > properly. Can anyone either tell me what I'm doing wrong, or show me > an example of setting a Timestamp value that works? > > Thanks very much. Code Follows > > Ed Brown > ------------------------------------------------------------------------ > > New(pTimeStamp); > DecodeDate(dtThis, i1,i2,i3); > pTimeStamp^.year := i1; > pTimeStamp^.Month := i2; > pTimeStamp^.Day := i3; > DecodeTime(dtThis, i1,i2,i3,i4); > pTimeStamp^.Hour := i1; > pTimeStamp^.minute := i2; > pTimeStamp^.second := i3; > pTimeStamp^.fraction := i4; > > New(piTemp); > lIntegers.Add(piTemp); > > // Fails on next call > retcode := SQLBindParameter(hSTMT, i + 1, SQL_PARAM_INPUT, > SQL_C_TYPE_TIMESTAMP, > SQL_TYPE_TIMESTAMP, > SizeOf(SQL_TIMESTAMP_STRUCT), 0 , > pTimeStamp, > SizeOf(SQL_TIMESTAMP_STRUCT), piTemp) ; > ------------------------------------------------------------------------ > The values are: > > pTimeStamp^.year = 200 > pTimeStamp^.Month = 7 > pTimeStamp^.Day = 15 > pTimeStamp^.Hour := 11 > pTimeStamp^.minute := 15 > pTimeStamp^.second := 0 > pTimeStamp^.fraction := 0 > --------------090306050905030102020207 Content-Type: text/x-vcard; charset=utf8; name="greg.campbell.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="greg.campbell.vcf" begin:vcard fn:Greg Campbell n:Campbell;Greg org:Michelin North America;ENG-IT adr;dom:;;2420 Two Notch Road;Lexington;SC;29071 email;internet:greg.campbell@us.michelin.com title:Systems Engineer tel;work:803-951-5561 tel;fax:803-951-5531 x-mozilla-html:FALSE version:2.1 end:vcard --------------090306050905030102020207--