- This topic has 3 replies, 2 voices, and was last updated 1 year, 7 months ago by .
Viewing 3 reply threads
Viewing 3 reply threads
- You must be logged in to reply to this topic.
Tagged: client, detail, kbmmw, master, TkbmMWQueryClient
Hello everyone,
I am developing a client using the Master/Detail architecture. However, I am facing an issue when using parameters in the Detail table query.
Scenario:
I have two tables in a database, a Master table and a Detail table, connected by a common field.
I am using Delphi (FMX) and TkbmMWQueryClient to implement this relationship.
When I do not use parameters in the Detail table query, everything works correctly and the data is displayed as expected.
Problem:
When I add parameters to the Detail table query to filter data based on the selection from the Master table, I receive the following server error: invalid variant operation.
Code Example:
DetailQuery.SQL.Text := ‘SELECT * FROM DetailTable WHERE MasterID = :MasterID’;
DetailQuery.ParamByName(‘MasterID’).AsInteger := MasterTable.FieldByName(‘MasterID’).AsInteger;
DetailQuery.Open;
Error Received:
invalid variant operation
Notes:
Without using parameters, the following code works correctly:
DetailQuery.SQL.Text := ‘SELECT * FROM DetailTable WHERE MasterID = 1’;
DetailQuery.Open;
I have checked the compatibility of data types and found no issues. Has anyone encountered something similar or have any suggestions on what might be causing this error?
Thank you all in advance for your help!
I’m thinking it might be a bug with UniDac/FireBird, as I ran the same test with SQLite and everything worked correctly, I’m reviewing everything but I can’t find where it could be wrong.
I found the problem.
The kbmMWServer1ServeRequest method was used for testing and log purposes, but this was causing the error mentioned, after removing the use of the method, everything worked perfectly, I will investigate how I can get around it.
Which line of code specifically caused the problem?