1 (edited by teco049 2017-07-31 08:26:41)

Topic: SOLVED: Problem with Tablegrid and SQL Statement

Dear Dimitry,


I get the attached error Message from Version 3.4 on a SQL statement which I use to fill a table grid.

Rechnerverwaltung.RSoftware.sqlValue := ('select software.id,software.softwarename from software left outer join softwarerechner on software.id=softwarerechner.id_software where softwarerechner.id_rechner='+inttostr(rechnerid));

Table structure:
SOFTWARE:

isdictionary=0
_Softwarename=TEXT
_Erfassung=DATETIME
_LetzteAenderung=DATE
_Bemerkungen=TEXT
_Freeware=BOOLEAN
_Lizenziert=BOOLEAN
_Demo=BOOLEAN
_Eigenentwicklung=BOOLEAN
_Shareware=BOOLEAN
_Sonderlizenz=BOOLEAN
%CALC_LizenzenTotal=(select count(ID) from Lizenzen where lizenzen.id_Software ^equally^ software.ID)\r\n
%CALC_LizenzenBenutzt=(select count(ID) from SoftwareRechner where SoftwareRechner.id_Software ^equally^ software.ID)\r\n

RECHNER:

isdictionary=0
_Rechnername=TEXT
_IP=TEXT
_Bemerkung=TEXT
_Erfassung=DATETIME
_LetzteAenderung=DATE
_Subnet=TEXT
_Seriennummer=TEXT
_Server=BOOLEAN
_Workstation=BOOLEAN
_Firewall=BOOLEAN
_Router=BOOLEAN
_USV=BOOLEAN
_Webcam=BOOLEAN
_Drucker=BOOLEAN
_NAS=BOOLEAN
_Sonstiges=BOOLEAN
_Notebook=BOOLEAN

SOFTWARERECHNER:

isdictionary=0
>id_Rechner=Rechner
>id_Software=Software

Its for a n:n relation. One "Rechner" can have many "Software" and one "Software" can be installed on many "Rechner"
DB Browser for SQLite is working with this statement, but not MyVisualDatabase.
Any idea?


Complete project is in german language and can be send only to you by email. Its not a public application.

Post's attachments

Attachment icon error.png 4.36 kb, 234 downloads since 2017-07-28 

Re: SOLVED: Problem with Tablegrid and SQL Statement

Hello Teco,


Not sure what

Rechnerverwaltung.RSoftware

is. If this is a Tablegrid that you want to fill with a query, you should try :


Rechnerverwaltung.RSoftware.dbSQL:= 'select software.id,software.softwarename from software left outer join softwarerechner on software.id=softwarerechner.id_software where softwarerechner.id_rechner='+inttostr(rechnerid);
Rechnerverwaltung.RSoftware.dbSQLExecute;

The first instruction loads the query and the second on executes it.


Hope this helped.


Cheers


Mathias


PS :
You can add before the dbSQLExecute command this line :

Rechnerverwaltung.RSoftware.dbListFieldsNames := 'Software ID,Sowftare Name';

This would result in setting the names you want for the Tablegrid columns you are filling instead of those coming from the query.


Also, using 'delete_col' in place of one of the column name would result in hiding the column.

I personally prefer setting visibility, column width, alignment, names etc. on a unique 'OnChange' event of the Tablegrid.

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: SOLVED: Problem with Tablegrid and SQL Statement

Thank you.