[SOLVED]DBLookupComboBox:

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

[SOLVED]DBLookupComboBox:

Post 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).
Last edited by dragondz on 15.04.2006, 11:06, edited 1 time in total.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Image
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

Post 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:
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

Post 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.
pol
Senior Boarder
Senior Boarder
Posts: 91
Joined: 13.10.2005, 08:19

Post 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...
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

Post 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
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

What type is field id_tva in the TDataSet object (the Datasource1.Dataset's)?
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

Post 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
);
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post 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?
dragondz
Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 29.03.2006, 10:54
Location: Algiers, Algeria
Contact:

Post 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:
Post Reply