Subject: | Re: Help with writing tcursor
| Date: | Thu, 21 May 2020 16:29:43 +1000
| From: | Tom Krieg <REMOVEtomkCAPITALS@sdassociates.com.au>
| Newsgroups: | pnews.paradox-programming
|
Don't use tc.locate, it can be tediously slow because it's a sequential
read. Use a unique index or primary key and do a tc.qlocate for an
instant retrieval. I gave up using queries back in '98 because my files
were large and queries took forever.
e.g
if not tcct1.open then errorshow() return end if
tf not tcct2.open then errorshow() tcct1.close() return end if
if not tcct1.edit then errorshow() tcct1.close() tcct2.close() return endif
tc.ct2.home()
tcct1.switchindex(MainID)
while not tcct2.eot()
if tcct1.qlocate(tcct2."Mainid" then
if tcct1.lockrecord() then
--- Update tcct1
else
--- Error
end if
else
if tcct1.insertrecord() then
--- Fill tcct1
else
--- Error
end if
end if
if Error then
tcct1.canceledit()
--- show error
quitloop
else
tcct1.unlockrecord()
tcct2.nextrecord()
end if
end while
tcct1.close()
tcct2.close()
On 21/05/2020 7:16 am, Kevin Baker wrote:
> If you look at the attached picture, I'm trying to update CT1.DB with
> the info from CT2.DB. I've been trying to do this with 12 different
> queries, which works somewhat. I get errors and some GPV, so was
> looking to see if this was possible by using a tcursor.
>
> I'm thinking if may require a tc.locate and not sure if doing a locate
> with a tc is recommended.
>
> Any help is very much appreciated.
|