Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 91AB69FB676 for ; Tue, 6 Mar 2007 10:32:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 10719-02 for ; Tue, 6 Mar 2007 10:32:07 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from smtpout14.attiva.biz (smtpout14.attiva.biz [85.37.16.16]) by postgresql.org (Postfix) with ESMTP id B62E19FB5A4 for ; Tue, 6 Mar 2007 10:32:07 -0400 (AST) Received: from FBCMFE02B15.fbc.local ([192.168.30.161]) by smtpout14.attiva.biz with Microsoft SMTPSVC(6.0.3790.1830); Tue, 6 Mar 2007 15:32:06 +0100 Received: from dream ([88.34.161.130]) by FBCMFE02B15.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Tue, 6 Mar 2007 15:32:05 +0100 Message-ID: <01be01c75ffc$3b333f00$1102a8c0@dream> Reply-To: "Shavonne Marietta Wijesinghe" From: "Shavonne Marietta Wijesinghe" To: References: <011901c75ff5$57a38930$1102a8c0@dream> <45ED80AB.A3DD.0030.0@indicator.be> Subject: Re: convert to a string Date: Tue, 6 Mar 2007 15:32:12 +0100 Organization: Studio FORM MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01BB_01C76004.9CA1E5E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-OriginalArrivalTime: 06 Mar 2007 14:32:05.0409 (UTC) FILETIME=[367FC910:01C75FFC] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.214 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200703/39 X-Sequence-Number: 27677 This is a multi-part message in MIME format. ------=_NextPart_000_01BB_01C76004.9CA1E5E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable when i try the=20 set oRs =3D oConn.Execute("SELECT N_GEN::int FROM MyTable ORDER BY N_GEN = DESC")=20 it returns 1 and for the rest i doens't change. alsways 10 :( ----- Original Message -----=20 From: Bart Degryse=20 To: pgsql-sql@postgresql.org=20 Sent: Tuesday, March 06, 2007 2:54 PM Subject: Re: [SQL] convert to a string I assume GetFieldValue is the name of a VB function or property get? Try either Set oRs =3D oConn.Execute("SELECT N_GEN::int FROM MyTable ORDER BY = N_GEN DESC") or GetFieldValue =3D cint(oRs("N_GEN")) + 1 or GetFieldValue =3D clng(oRs("N_GEN")) + 1 In the last two cases make sure that the function or property get = returns an int or long Also remember that if oRs("N_GEN") is NULL the sum will also be NULL >>> "Shavonne Marietta Wijesinghe" = 2007-03-06 14:42 >>> Hello=20 i have a column N_GEN in postgreSql defined as text. In this coloumn i = insert a number 10 N_GEN (text) =3D 10=20 on error resume next Set oRs =3D oConn.Execute("SELECT N_GEN FROM MyTable ORDER BY N_GEN = DESC") If err <> 0 then 'If table not found GetFieldValue =3D "1" else GetFieldValue =3D oRs("N_GEN") + 1 End If But it doesn't add the 1 to my N_GEN How can i set the Recordset to convert the string to a number and then = add 1 to it?? Shavonne Wijesinghe http://www.studioform.it ------=_NextPart_000_01BB_01C76004.9CA1E5E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
when i try the
set oRs =3D=20 oConn.Execute("SELECT N_GEN::int FROM MyTable ORDER BY N_GEN DESC")=20
it returns 1 and for the rest i doens't change. = alsways=20 10
 :(
----- Original Message -----
From:=20 Bart Degryse
Sent: Tuesday, March 06, 2007 = 2:54=20 PM
Subject: Re: [SQL] convert to a = string

I assume GetFieldValue is the name of a VB function or = property=20 get?
 
Try either
  Set oRs =3D = oConn.Execute("SELECT=20 N_GEN::int FROM MyTable ORDER BY N_GEN DESC")
or
   GetFieldValue =3D=20 cint(oRs("N_GEN")) + 1
or
   GetFieldValue =3D=20 clng(oRs("N_GEN")) + 1

In the last two cases make sure that the = function or property get returns an int or long
Also remember that if oRs("N_GEN") is = NULL the=20 sum will also be NULL

>>> "Shavonne Marietta=20 Wijesinghe" <shavonne.marietta@studioform.it> 2007-03-06 14:42=20 >>>
Hello

i have a = column N_GEN in=20 postgreSql defined as text. In this coloumn i insert a number = 10

N_GEN=20 (text) =3D 10
 
 
on error resume = next
  Set oRs =3D=20 oConn.Execute("SELECT N_GEN FROM MyTable ORDER BY N_GEN=20 DESC")
  If err <> 0 then 'If table not=20 found
   GetFieldValue =3D=20 "1"
  else
   GetFieldValue =3D = oRs("N_GEN") +=20 1
  End If
 
But it doesn't add the 1 to my N_GEN
How can i set the = Recordset to=20 convert the string to a number and then add 1 to it??
 
Shavonne Wijesinghe
http://www.studioform.it
 

 
------=_NextPart_000_01BB_01C76004.9CA1E5E0--