realbasic-nug
[Top] [All Lists]

databasecursor

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: databasecursor
From: Gerd Wilmer <gerd at landmarktravel dot com dot au>
Date: Mon, 31 Dec 2001 15:26:40 +1100
Why doesn't the cursor go to the next record??
I store parsed text files in a temporary table on the server.
I now need to allocate some records to a booking number and then store in the 
correct tables (four
in total)
My SQL Query works, I get the correct number of records into the cursor, but 
when I try to insert
the records into the correct table tand then delete these records from the temp 
table.
The cursor will not move to the next record. I get the same record repeatedly 
added to the new
table.
It does not mater whether I delete the retrieved record or not - the 
cur.MoveNext does absolutely
nothing.

Any suggestions??

Gerd Wilmer







  cur=db.SQLSelect("Select count(*) AirlineCode, AirlineName,ArrivalDate, 
ArrivalTime,
BaggageAllowance, BookingStatus, Class, DepartureDate, DepartureTime, 
Destination, Distance,
DownloadDate, DownloadTime, Equipment, FlightNumber, FlightOperatedBy, 
FlyingTime, Origin, PaxName,
PNR, PNRDate, PNRTime, SeatData, SectorNumber, SectorType, _rowid from 
UnclaimedPNR where RecordType
= 'Air' and PNR = '"+t+"'")
  i=cur.idxField(1).integerValue //  the number of records retrieved - works 
fine

  if i >0 then
    for j=1 to i

      rec = new databaseRecord
      rec.Column("AirlineCode")=cur.IdxField(2).stringValue
      rec.Column("AirlineName")=cur.IdxField(3).stringValue
      rec.dateColumn("ArrivalDate")=cur.IdxField(4).DateValue
      rec.Column("ArrivalTime")=cur.idxField(5).NativeValue
      rec.Column("BaggageAllowance")=cur.idxField(6).stringValue
      rec.column("BookingStatus")=cur.idxField(7).stringValue
      rec.Column("Class")=cur.idxField(8).stringValue
      rec.dateColumn("DepartureDate")=cur.idxField(9).dateValue
      rec.Column("DepartureTime")=cur.idxField(10).NativeValue
      rec.Column("Destination")=cur.idxField(11).stringValue
      rec.DoubleColumn("Distance")=cur.idxField(12).doubleValue
      rec.dateColumn("DownloadDate")=cur.idxField(13).dateValue
      rec.Column("DownloadTime")=cur.idxField(14).nativeValue
      rec.Column("Equipment")=cur.idxField(15).stringValue
      rec.Column("FlightNumber")=cur.idxField(16).stringValue
      rec.Column("FlightOperatedBy")=cur.idxField(17).stringValue
      rec.Column("FlyingTime")=cur.idxField(18).stringValue
      rec.Column("Origin")=cur.idxField(18).stringValue
      rec.Column("PNR")=cur.idxField(20).stringValue
      rec.DateColumn("PNRDate")=cur.idxField(21).dateValue
      rec.Column("PNRTime")=cur.idxField(22).nativeValue
      rec.Column("SeatData")=cur.idxField(23).stringValue
      rec.IntegerColumn("SectorNumber")=cur.idxField(24).integerValue
      rec.Column("SectorType")=cur.idxField(25).stringValue
      rec.IntegerColumn("BookingNumber")=val(BookingNumber.text)

      db.InsertRecord "FlightSector", rec
      cur.edit
      cur.deleteRecord // works for the first record only

      cur.MoveNext // does not work

    next
  end if




<Prev in Thread] Current Thread [Next in Thread>
  • databasecursor, Gerd Wilmer <=