9

Lazarus Free Pascal / Delphi - RunError 211

 2 years ago
source link: https://www.codesd.com/item/lazarus-free-pascal-delphi-runerror-211.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Lazarus Free Pascal / Delphi - RunError 211

advertisements

I'm trying to connect my Windows XP program (Lazarus) to my Ubuntu postgres server.

When the Lazarus program runs, it seems to compile fine but I get this error:

Project ... raised exception class 'RunError(211)'.

Then it terminates execution (and I don't see any output), and opens up a file customform.inc. In that file, it shows a procedure procedure TCustomForm.DoCreate; where it highlights a line: if Assigned(FOnCreate) then FOnCreate(Self);

I believe this is one of the system's files.

I never get to see any output. What could this be? Thanks!

MORE INFO:

I've narrowed down the error to this line:

  dbQuery_Menu.SQL.Text:='Select * From "tblMenus"';

  dbQuery_Menu.Open;

the exception is triggered when the OPEN statement gets executed.

BTW, dbQuery_Menu is defined as a TSQLQuery component.

Clueless! :(


After nearly 5 days I found the answer. Many thanks to all thos e ho have contributed with their ideas ESPECIALLY RRUZ, RBA and Guillem Vicens. there are other related posts all connected to getting the FIRST Lazarus program working with PostgreSQL.

Summary.

  1. The biggest mistake I made here was that I used the TSQLConnection component. Don't do this. Instead use the TPQConnection.

  2. Everything is done through code. We're not using any draggable components from the top tab.

  3. Don't rely on the Lazarus docs (wiki) at least for working with PG DBs.. It is outdated. Some of the examples can be pretty misleading.

  4. Make sure that fields have some default values. For example, if a Boolean field has no true or false (t/f) set, this may lead to errors.

And that's it! I hope many postgres+Lazarus newbies will find this useful.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK