Recent

Author Topic: [SOLVED] Lookup error using autoincrement field  (Read 3561 times)

emaza

  • New Member
  • *
  • Posts: 41
    • http://GerenciaDeCondominios.com
[SOLVED] Lookup error using autoincrement field
« on: July 22, 2012, 12:11:45 am »
Hi

My program uses an old existing MS Access table and needs to locate records for editing. Table has an "Id" field which is an autoincrement field, but  Queryx.locate ('Id', myvariable, options) gives runtime error "AutoInc Fields are read-only". I understand this is a fixed bug.

Was using 0.9.30-fpc-2.4.2, so I tried snaphot 0.9.31-3407-fpc-2.60, and then 1.1-37961-2.6.0 both with same problem, so loaded latest stable 0.9.30.4-fpc-2.6.0 which I am now using.

Downloaded patch "autoinc.patch"and after days of googling, managed to have it find the files to patch, runing it with patch.exe, and using --dry-run option, but I get this:

Patching file 'bufdataset.pas'
Assertion failed: hunk, file patch.c, line 321

Questions:
1. Is there an alternative or workarround to avoid using lookup?
2. Ive read AutoInc.patch and seems simple to open bufdataset.pas and fields.inc files in the IDE, make changes by hand, and then perhaps use rebuild lazarus: myprofile. ¿Will this work?
3. Is there simply a mistake in what I have tried? All I know is self taught and don't know much.

Thanks anyone. Need help.   :(
« Last Edit: July 24, 2012, 02:24:52 am by emaza »

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Lookup error using autoincrement field
« Reply #1 on: July 22, 2012, 06:47:38 am »
What patch (bug/issue number) are you referring to?
A lot of db patches have been applied to fpc 2.6.1. Instead of applying the patch yourself and rebuild fpc (bufdataset is part of fpc, not lazarus), it is easier to install 2.6.1. You can download the latest lazarus + fpc 2.6.1 snapshot from http://freepascal.dfmk.hu/test/lazarus/.

emaza

  • New Member
  • *
  • Posts: 41
    • http://GerenciaDeCondominios.com
Re: Lookup error using autoincrement field
« Reply #2 on: July 22, 2012, 11:24:45 am »
Hi ludob,

I was using autoinc.patch (2012-03-15 07:11) file downloaded from Freepascal bugtracker Id 0017624 . Page says Status Closed, fixed on revision 20943, although inside the autoinc.patch file says revision 20518.

Downloaded Laz 1.1-37902-fpc-2.6.1-20120709-win32 from your link as sugested. Although could not load source file properly for some reason, resulting in IDE autocomplete not functioning, my program compiled and Lookup runtime error is no longer there. Not yet sure if it looks-up records ok, but supose it does.

Many many thanks for your help. Using a snapshot worries me, but THIS problem is solved. Donot know how to flag it "solved"..
:D

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Lookup error using autoincrement field
« Reply #3 on: July 22, 2012, 12:04:52 pm »
Many many thanks for your help. Using a snapshot worries me, but THIS problem is solved. Donot know how to flag it "solved"..
Thanks for the update & glad it works for you ;)

The snapshots are rather good this time of year ;) (Actually, they often contain more fixed bugs versus new bugs...but your mileage may vary).

You can edit the subject of your first post and add e.g. [SOLVED] in front of the subject.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

emaza

  • New Member
  • *
  • Posts: 41
    • http://GerenciaDeCondominios.com
Re: [SOLVED] Lookup error using autoincrement field
« Reply #4 on: July 24, 2012, 02:40:54 am »
oK, flaged it solved.

Thanks guys, appreciate your interest. Hope the next snapshpt with fpc 2.6.1 brings back the autocomplete function which now gives me a missing semicolon error...  8-)

emaza

  • New Member
  • *
  • Posts: 41
    • http://GerenciaDeCondominios.com
Re: [SOLVED] Lookup error using autoincrement field
« Reply #5 on: July 28, 2012, 11:00:16 pm »
For the record and future viewers:

Nothing wrong with the snapshot. My path setting on IDE configure was wrong (C.\lazarus\fpc\source\rtl\Win32) correct is: C:\lazarus\fpc\source\

Ref: http://lazarus.freepascal.org/index.php?topic=14451.0

 :-[ Bye