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 8C3013A4323 for ; Wed, 17 Nov 2004 19:03:46 +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 79955-01 for ; Wed, 17 Nov 2004 19:03:41 +0000 (GMT) Received: from mail.arcompanies.net (unknown [66.249.130.221]) by svr1.postgresql.org (Postfix) with ESMTP id 0497C3A430D for ; Wed, 17 Nov 2004 19:03:40 +0000 (GMT) Received: from fame.arcompanies.net ([69.3.176.250] helo=ebrown) by mail.arcompanies.net with smtp (Exim 3.35 #1 (Debian)) id 1CUV5f-0004YE-00 for ; Wed, 17 Nov 2004 11:03:40 -0800 Message-ID: <07d901c4ccd8$254b2360$fb04a8c0@arcHead.arcompanies.net> From: "Ed Brown" To: Subject: SQL Error- SQLBindColumn and TimeStamp Field Date: Wed, 17 Nov 2004 11:03:38 -0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_07D6_01C4CC95.1707D840" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=HTML_30_40, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200411/81 X-Sequence-Number: 4695 This is a multi-part message in MIME format. ------=_NextPart_000_07D6_01C4CC95.1707D840 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 :=3D i1; pTimeStamp^.Month :=3D i2; pTimeStamp^.Day :=3D i3; DecodeTime(dtThis, i1,i2,i3,i4); pTimeStamp^.Hour :=3D i1; pTimeStamp^.minute :=3D i2; pTimeStamp^.second :=3D i3; pTimeStamp^.fraction :=3D i4; New(piTemp); lIntegers.Add(piTemp); // Fails on next call retcode :=3D 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 =3D 200 =20 pTimeStamp^.Month =3D 7 pTimeStamp^.Day =3D 15 pTimeStamp^.Hour :=3D 11 pTimeStamp^.minute :=3D 15 pTimeStamp^.second :=3D 0 pTimeStamp^.fraction :=3D 0 ------=_NextPart_000_07D6_01C4CC95.1707D840 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I have been trying to do an insert into = a TimeStamp=20 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=20 should be able to see what's happening.  I get the text as a = string, parse=20 it into the various elements, and populate the=20 SQL_TimeStamp_Structure. When I execute the SQLBindColumn function = I get=20 the following message:
 
    Unable to Bind = Parameter- State:=20 S1003, Error # 0, [Microsoft][ODBC Driver Manager] Program type out of=20 range
 
The values in the structure are = reasonable, and=20 other elements work properly. Can anyone either tell me what I'm = doing=20 wrong, or show me an example of setting a Timestamp value that=20 works?
 
Thanks very much. Code = Follows
 
Ed Brown

 
 New(pTimeStamp);
 DecodeDate(dtThis,=20 i1,i2,i3);
 pTimeStamp^.year :=3D i1;
 pTimeStamp^.Month = :=3D=20 i2;
 pTimeStamp^.Day :=3D i3;
 DecodeTime(dtThis,=20 i1,i2,i3,i4);
 pTimeStamp^.Hour :=3D = i1;
 pTimeStamp^.minute :=3D=20 i2;
 pTimeStamp^.second :=3D i3;
 pTimeStamp^.fraction = :=3D=20 i4;
 
 New(piTemp);
 lIntegers.Add(piTemp);
 
// Fails on next call
 retcode :=3D SQLBindParameter(hSTMT, i + 1,=20 SQL_PARAM_INPUT,
  SQL_C_TYPE_TIMESTAMP,
  SQL_= TYPE_TIMESTAMP,
  SizeOf(SQL_TIMESTAMP_STRUCT),=20 0 ,
  pTimeStamp,
  SizeOf(SQL_TIMESTAMP_S= TRUCT),=20 piTemp) ;

The values are:
 
    pTimeStamp^.year =3D 200    =
    pTimeStamp^.Month =3D  7
    pTimeStamp^.Day = =3D 15
   =20 pTimeStamp^.Hour :=3D 11
    pTimeStamp^.minute=20 :=3D 15
    pTimeStamp^.second=20 :=3D 0
    pTimeStamp^.fraction :=3D = 0
 
------=_NextPart_000_07D6_01C4CC95.1707D840--