Page 1 of 1

[SOLVED]DBLookupComboBox:

Posted: 09.04.2006, 14:19
by dragondz
Hi everybody,
I am newbie in Delphi and try to learn everyday something new!

A friend of mine advise me to use Zeos tools and sqlite for my first (little) project!

Zeos Lib are marvelous and are easy to use (great for me :oops: )!

First : i use Delphi 7, ZeosLib 6.5.1(alpha) (Dec 2005), and Sqlite 2.8 (waiting for new release of zeos adding the 3.0 DB :p ).

My DB contain 2 tables: Article(id, name, id_tva), TVA(id, val)
Article.id is autoincrement and Article.id_tva is Integer;

The program work fine : adding data in table article and tva, reading data from DB!

I add a DBLookupComboBox to form Article who connect Article.id_tva to TVA.id: when i run the prog i get the right result: a list with TVA.val in listbox!

The error comes when I try to change a valu in the listbox for an article, a fatal error came withe this message :
raised exception class EDatabaseError with message cannot access field 'id_tva' type Variant
I search in the forum (and others) but don t find where is the mistake!

Can someone help me please! I am newbie and want to progress!

Thanks and excuse me for my bad english (I talk better in French).

Posted: 10.04.2006, 08:34
by mdaems
Did you try ZEOSDBO SVN version? Please check some recent thread concerning CVS for details. I know there's been some bug with DBLookupCombo's.
I Also think SQLite3 is available, but I never checked that... Wait... YES, there's already some coding there.

Bonne chance!!

Mark

Posted: 10.04.2006, 13:33
by dragondz
Thanks for answer,

I try to get the cvs version but I can't get it , I tye Tortoise but have error message when trying!

Is there another way to get a newer version?

et Merci

Posted: 10.04.2006, 14:29
by mdaems
Hi,
Did you try CVS or SVN? I don't know whether CVS works. SVN definitely does. The repository address is svn://firmos.at/zeos/trunk
You should be able to checkout anonymously.
I use tortoiseSVN and that works well.

Mark

Posted: 10.04.2006, 15:51
by dragondz
Thanks,

I use SVN for the first time! I get the last version and I will test soon to know if the pb is solved.

I try to compile the new package (for delphi 7) and get a compile error :
[Error] ZSequence.pas(103): Undeclared identifier: 'GetCurrentValueSQL'
Any idea of what to do?

It s hard to be a newbi :oops:

Posted: 12.04.2006, 13:06
by dragondz
I fainally installed the svn version, I tried to compil Zconnection.bpl directly , the right way is to compile each .bpl in the right order.

But the error message in my first post is still remaining.

Posted: 13.04.2006, 09:03
by pol
What makes me suspicious is this "type variant" in your first error message, although it is integer, as if it is not recognized where it belongs to.
Did you define persistent TFields, by double clicking on the table or query icon on the form and selecting "add all fields" after right clicking in the fields editor?
Have you got everything in the right place in your DBLookupComboBox?
DataField: id_tva, DataSource: the one pointing to Article, KeyField id, ListField val, ListSource: DataSource pointing to TVA
It is sometimes difficult using DBLookupComboBox...

Posted: 13.04.2006, 10:38
by dragondz
Hi pol, and thanks for answering,

It s true I added persistent field, I do that to change width column in a DBGrid, I remove all the persistent Fields in the prog, but still got the same error message!

I think I have all thinks in right place in the DBLookupComboBox because I got the right List!

Image

Image

Posted: 13.04.2006, 13:02
by zippo
What type is field id_tva in the TDataSet object (the Datasource1.Dataset's)?

Posted: 13.04.2006, 13:19
by dragondz
Here is the sql statement of the DB (sqlite3):
CREATE TABLE "article" (
"id" INTEGER PRIMARY KEY NULL,
"article" varchar(100) NOT NULL,
"ref" varchar(100) UNIQUE NOT NULL,
"prix" FLOAT(10,2) DEFAULT '1' NOT NULL,
"id_tva" int(11) DEFAULT '0' NOT NULL
);

CREATE TABLE "tva" (
"id" INTEGER PRIMARY KEY NULL,
"nom" varchar(100) NOT NULL,
"valeur" FLOAT(10,2) DEFAULT '0' NOT NULL
);

Posted: 13.04.2006, 18:41
by zippo
The SQL seems OK, but I would ask for the field object description - can you make a screenshot of the Object inspector when displaying the field properties in the dataset?

Posted: 15.04.2006, 11:05
by dragondz
Hi everybody,

I finally found the bug!!

It is in the definition of id_tva! the pb was that id_tva is INT but tva.id is INTEGER PRIMARY KEY: in sqlite INT and INTEGER are different, then when I put id_tva INTEGER that solve the pb!

Thanks all for your help, when reading your posts gave me the right way to find the mistake. :)

I will surely come back for other questions I still newbie :oops: