Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 205F89FBAB1 for ; Tue, 6 Mar 2007 10:49:38 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 10825-06 for ; Tue, 6 Mar 2007 10:49:12 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from smtpout09.attiva.biz (smtpout09.attiva.biz [85.37.16.7]) by postgresql.org (Postfix) with ESMTP id 82A8D9FB9BA for ; Tue, 6 Mar 2007 10:49:21 -0400 (AST) Received: from fbcmfe02b04.fbc.local ([192.168.30.33]) by smtpout09.attiva.biz with Microsoft SMTPSVC(6.0.3790.1830); Tue, 6 Mar 2007 15:49:11 +0100 Received: from dream ([88.34.161.130]) by fbcmfe02b04.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Tue, 6 Mar 2007 15:49:10 +0100 Message-ID: <01d801c75ffe$9e2ab780$1102a8c0@dream> Reply-To: "Shavonne Marietta Wijesinghe" From: "Shavonne Marietta Wijesinghe" To: Subject: Re: convert to a string Date: Tue, 6 Mar 2007 15:49:17 +0100 Organization: Studio FORM MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01D5_01C76006.FF7CAEA0" 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:49:10.0412 (UTC) FILETIME=[9972D4C0:01C75FFE] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.184 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200703/41 X-Sequence-Number: 27679 This is a multi-part message in MIME format. ------=_NextPart_000_01D5_01C76006.FF7CAEA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable i figured it out Set oRs =3D oConn.Execute("SELECT N_GEN FROM " & MyTable & " ORDER BY = N_GEN::INT DESC") thanks to everyone ----- Original Message -----=20 From: Shavonne Marietta Wijesinghe=20 To: pgsql-sql@postgresql.org=20 Sent: Tuesday, March 06, 2007 3:32 PM Subject: Re: [SQL] convert to a string 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_01D5_01C76006.FF7CAEA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
i figured it out
 
Set oRs =3D oConn.Execute("SELECT N_GEN = FROM " &=20 MyTable & " ORDER BY N_GEN::INT DESC")
 
thanks to everyone
----- Original Message -----
From:=20 Shavonne Marietta = Wijesinghe=20
Sent: Tuesday, March 06, 2007 = 3:32=20 PM
Subject: Re: [SQL] convert to a = string

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=20 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=20 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 = >>>
Hello

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

N_GEN (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_01D5_01C76006.FF7CAEA0--