Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id C21829FB62C for ; Tue, 6 Mar 2007 10:38:56 -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 11646-02 for ; Tue, 6 Mar 2007 10:38:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 925629F9FE2 for ; Tue, 6 Mar 2007 10:38:47 -0400 (AST) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Tue, 06 Mar 2007 15:26:12 +0100 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Tue, 06 Mar 2007 15:38:45 +0100 Message-Id: <45ED8AFA.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Tue, 06 Mar 2007 15:38:34 +0100 From: "Bart Degryse" To: Cc: "Shavonne Marietta Wijesinghe" Subject: Re: convert to a string References: <011901c75ff5$57a38930$1102a8c0@dream><45ED80AB.A3DD.0030.0@indi cator.be> <01be01c75ffc$3b333f00$1102a8c0@dream> In-Reply-To: <01be01c75ffc$3b333f00$1102a8c0@dream> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part4662E3FA.0__=" X-imss-version: 2.046 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.395 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200703/40 X-Sequence-Number: 27678 --=__Part4662E3FA.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable As Andreas already asked: do you really have a good reason to store = numbers as text If so, show us some more information: table definition, some table data, a = complete (vb?) function/property get, ... anything that is directly = involved. >>> "Shavonne Marietta Wijesinghe" = 2007-03-06 15:32 >>> 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 ( mailto:Bart.Degryse@indicator.be )=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? =20 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 =20 =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 =20 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?? =20 Shavonne Wijesinghe http://www.studioform.it ( http://www.studioform.it/ ) =20 =20 --=__Part4662E3FA.0__= Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Description: HTML
As Andreas already asked: do you really have a good reason to store = numbers as text
If so, show us some more information: table definition, some table = data, a complete (vb?) function/property get, ... anything that is = directly involved.


>>> "Shavonne Marietta Wijesinghe" <shavonne.marie= tta@studioform.it> 2007-03-06 15:32 >>>
when i try the
set oRs =3D = oConn.Execute("SELECT N_GEN::int FROM MyTable ORDER BY N_GEN DESC") =
it returns 1 and for the rest i doens't change. = alsways 10
 :(
----- Original Message -----
= From: Bart Degryse
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("SELE= CT 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" <shavonne.marietta@studioform.it> 2007-03-06 14:42 = >>>
Hello

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

N_GEN (text) =3D 10
 
 
on error resume next
  Set = oRs =3D oConn.Execute("SELECT N_GEN FROM MyTable ORDER BY N_GEN DESC")
&= nbsp; If err <> 0 then 'If table not found
   = GetFieldValue =3D "1"
  else
   GetFieldValu= e =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
 

 
--=__Part4662E3FA.0__=--