Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OraDynaset.Fields() and variable assignment

Status
Not open for further replies.

bealke

Technical User
Feb 27, 2006
2
US
Hi everyone, I was wondering if anyone could lend me some help on a problem I am having.

Currently my asp page reads and interacts with my oracle database just fine, however i'm having a problem with either my if statement cause it's putting out wrong values or perhaps it is what i put in my if statement.

About the code i'm writing, in the database every element has a primary key (as it should) that is simply an interger from 1 to whatever. I want users to be able to remove rows from the database, which would leave "gaps" in the primary key, for example:

PID (stands for Primary ID)
1
2
3
4

6
7
...

if the user removed row 5. Now, my asp code will read the data in from an oracle databse, and SHOULD find the gap, and assign the missing number automatically when the user submits a new row.

so here is the problem im having:


newnum=0
dbnum=0
old=0

Do While(OraDynaset.EOF = FALSE)

old=OraDynaset.Fields("PID")
OraDynaset.MoveNext
newnum=OraDynaset.Fields("PID")
dbnum=newnum 'what will be the "gap"
'if no gap will be last num +1

if newnum<>old+1 then
dbnum=old
exit do
end if
Loop

Set OraSession = Nothing

-----------------------------------

then i increment dbnum+1 after and add some formatting and blah blah... ANYWAYS

my main problem is my if statement really does not work. I've checked the values all my variables output with a simple response.write(....) and I always get that

newnum=2
old =1
old+1 =2

however,
newnum<>old+1 results in TRUE when it should be FALSE..
also incase you're wondering
newnum=old+1 results in FALSE when it should be TRUE..

if anyone has any idea why in the hell this is happening i would be incredible grateful. One thing that came to my mind was assigning the OraDynaset.Fields("PID").

Also it may seem like the logical thing to do would be to simply use an = instead of <> since it seems reversed, but this doesn't work either.
 
my friend, you are absolutly amazing!
Thank you for the blazing fast reply :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top