EAssertionFailed with message "Wrong DataSet"
Posted: Wed 26 Mar 2008 15:08
Hello, I've been developing a software with delphi 2007 and I'm using the MyDAC components to access a MySQL Database. I will try to explain steo by step my situation. However, it's kind of complicated:
1.- My application has a main Form wich calls another form using a classfunction that i create.
2.- In this classfunction I pass a VirtualTable to the child form, 'cause they both will be working with the same data, so that i don't have to create another VirtualTable.
3.- So in the class function i have a pice of code like this:
class function TFFFormChild(inv: TVirtualTable; a: string; b: String; c: TFloatField): boolean;
var
f: TFFSerialesPt;
begin
f := TFFSerialesPt.Create(Application);
f.DSSeriales.DataSet := inv;
Result := f.ShowModal = mrOk;
end;
DSSeriales is a datasource that is placed in the child form and as you can see i assign the dataset "inv" to it.
4.- Later, in another piece of code i try to do an append and copying some data to that dataset using the sentences:
DSSeriales.Dataset.Append;
DSSeriales.Dataset.FieldByName('a').AsString := 'Anything';
DSSeriales.Dataset.Post;
At this point i get an exception that says EAssertionFailed with Message "Wrong DataSet" and it points to the unit MemDS.pas
I'll appreciate any kind of help that you could give me.
1.- My application has a main Form wich calls another form using a classfunction that i create.
2.- In this classfunction I pass a VirtualTable to the child form, 'cause they both will be working with the same data, so that i don't have to create another VirtualTable.
3.- So in the class function i have a pice of code like this:
class function TFFFormChild(inv: TVirtualTable; a: string; b: String; c: TFloatField): boolean;
var
f: TFFSerialesPt;
begin
f := TFFSerialesPt.Create(Application);
f.DSSeriales.DataSet := inv;
Result := f.ShowModal = mrOk;
end;
DSSeriales is a datasource that is placed in the child form and as you can see i assign the dataset "inv" to it.
4.- Later, in another piece of code i try to do an append and copying some data to that dataset using the sentences:
DSSeriales.Dataset.Append;
DSSeriales.Dataset.FieldByName('a').AsString := 'Anything';
DSSeriales.Dataset.Post;
At this point i get an exception that says EAssertionFailed with Message "Wrong DataSet" and it points to the unit MemDS.pas
I'll appreciate any kind of help that you could give me.