Re: convert to a string

From: "Bart Degryse" <Bart(dot)Degryse(at)indicator(dot)be>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: convert to a string
Date: 2007-03-06 13:54:35
Message-ID: 45ED80AB.A3DD.0030.0@indicator.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I assume GetFieldValue is the name of a VB function or property get?

Try either
Set oRs = oConn.Execute("SELECT N_GEN::int FROM MyTable ORDER BY N_GEN DESC")
or
GetFieldValue = cint(oRs("N_GEN")) + 1
or
GetFieldValue = 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(dot)marietta(at)studioform(dot)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) = 10

on error resume next
Set oRs = oConn.Execute("SELECT N_GEN FROM MyTable ORDER BY N_GEN DESC")
If err <> 0 then 'If table not found
GetFieldValue = "1"
else
GetFieldValue = 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 ( http://www.studioform.it/ )


In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ezequias Rodrigues da Rocha 2007-03-06 13:55:23 Re: [SQL] Time of executed query
Previous Message Bart Degryse 2007-03-06 13:45:01 Re: Time of executed query