Variant error on saving report
I'm using Delphi 5, ASTA 3, and RB 6.02. When using the Report Designer,
I am getting an illegal variant conversion error after saving a new
report. The error is tenacious and does not let me exit the program
normally. It has to be manually shut down. Checking the database
afterwards, the report has in fact been saved.
I recall other threads mentioning the importance of retrieving
autoincrement fields when using ASTA, and all of that setup is in place.
Any direction on where to look for a cause would be appreciated.
Mark Shapiro
infocus@swbell.net
I am getting an illegal variant conversion error after saving a new
report. The error is tenacious and does not let me exit the program
normally. It has to be manually shut down. Checking the database
afterwards, the report has in fact been saved.
I recall other threads mentioning the importance of retrieving
autoincrement fields when using ASTA, and all of that setup is in place.
Any direction on where to look for a cause would be appreciated.
Mark Shapiro
infocus@swbell.net
This discussion has been closed.
Comments
ASTA's website? Which database are you using? If it is Interbase, then try
setting ForcedRefresh property on the Interbase data access components on
the server.
Make sure to set the RefetchOnInsert property on the Folder and Item ACDS.
You can test what RB does by using some code like this in a test project to
see if you can get the auto increment field value back after a post. On the
form I have a button, a DBGrid, the ACS and ACDS.
...
Button1: TButton;
AstaClientSocket1: TAstaClientSocket;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
AstaClientDataSet1: TAstaClientDataSet;
....
procedure TForm1.Button1Click(Sender: TObject);
var
liID: Integer;
begin
AstaClientDataSet1.Edit;
AstaClientDataSet1.Insert;
AstaClientDataSet1.FieldByName('FolderID').AsInteger := 0;
AstaClientDataSet1.FieldByName('Name').AsString := 'DMTest';
AstaClientDataSet1.FieldByName('Size').AsInteger := 1500;
AstaClientDataSet1.FieldByName('ItemType').AsInteger := 1;
AstaClientDataSet1.FieldByName('Modified').AsDateTime:= Now;
AstaClientDataSet1.FieldByName('Deleted').AsDateTime := Now;
AstaClientDataSet1.Post;//works like RB does
// AstaClientDataSet1.ApplyUpdates(usmServerTransaction); will work instead
of post
end;
procedure TForm1.AstaClientDataSet1AfterRefetchOnInsert(Sender: TObject;
BookMarkList: TStrings);
var
liID: Integer;
begin
liID := AstaClientDataSet1.FieldByName('ItemID').AsInteger;
Showmessage('ClientAutoIncID: ' + IntToStr(liID));
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
the "invalid variant conversion error" was the fact that I had installed
the AstaDADE package but had not properly compiled daAsta.pas and placed
it in the RB Lib folder. Now I can save reports and am getting table and
field name list boxes to populate when using the Query Wizard, something
I had not seen before.
However, when attempting to save the report just defined with the Query
Wizard, I get a "no AstaClientSocket or it is not connected" error. In
searching the newsgroup archives, I found a reference to this problem
which suggested that AstaClientSocket.Active := false calls need to be
commented out of daAsta.pas. Is that, in fact, the recommended fix?
Also, just to be sure, are these the correct Designer DataSettings when
connecting to an Adapative Server Anywhere 7 database through ASTA:
DatabaseName - AstaClientSocket1
DatabaseType - dtSybaseASA
SessionType - AstaSession
SQLType - sqSQL2
Mark Shapiro
infocus@swbell.net
I have running for other databases.
What happens when you comment it out? Does it not work?
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
I get no error but I also (this may or may not be related) get no data
returned on the preview. If I can't get AstaDADE to work, can you
suggest a Plan B? The clock is ticking on this project and I need to
deliver an end user design solution to a customer.
Mark Shapiro
infocus@swbell.net
newsgroup archives for the third time and found a thread I had
previously missed. A user in Australia described the disconnection
problem I've been experiencing when running RB with AstaDADE and then
trying to save a report created with QueryBuilder. He suggested that the
Designer and Dictionary components needed their own dedicated
AstaClientSocket when used in conjunction with AstaDADE.
I did that and, lo and behold -- no errors and data flowing. I'm greatly
relieved. I'd encourage you to add this solution to your FAQ for ASTA
users. Also handy would be the other most commonly encountered problem.
ASTA requires that item, folder, and data dictionary tables list the
autoincrement field as a dataset property and that they be added to the
RefetchOnInsert list to avoid "invalid variant conversion" errors when
attempting to save a report.
Mark Shapiro
infocus@swbell.net