S
sunnydty
Unregistered / Unconfirmed
GUEST, unregistred user!
我用一个窗体对一个表teacher进行插入操作,该表和lesson表关联,我用了三个查找字段。程序如下:
procedure Tinputteacher.Button1Click(Sender: TObject);
var
id1,id2,id3:integer;
begin
//DataModule2.dsinputteacher.DataSet.edit;
//DataModule2.dsinputteacher.DataSet.Post;
//DataModule2.dsinputteacher.DataSet.insert;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('teachername').value
:=edit1.Text;
datamodule2.ADODataSetlesson.Open;
datamodule2.ADODataSetlesson.Locate
('lsnname',VarArrayOf([DBLookupComboBox3.Field]),[loPartialKey]);
id1:=datamodule2.ADODataSetlesson.fieldbyname('lessonid').Value;
datamodule2.ADODataSetlesson.Locate
('lsnname',VarArrayOf([DBLookupComboBox4.Field]),[loPartialKey]);
id2:=datamodule2.ADODataSetlesson.fieldbyname('lessonid').Value;
datamodule2.ADODataSetlesson.Locate
('lsnname',VarArrayOf([DBLookupComboBox5.Field]),[loPartialKey]);
id3:=datamodule2.ADODataSetlesson.fieldbyname('lessonid').Value;
datamodule2.ADODataSetlesson.close;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('lessonid1').value
:=id1;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('lessonid1').value
:=id2;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('lessonid1').value
:=id3;
datamodule2.ADODataSetlklsn.ExecSQL;
end;
调试时在三个locate函数处报错
“incompatible types:'variant' and 'tfield'” 和
“incompatible types:'tlocateoption' and'integer'”
请问是什么原因,是不是locate函数有错?
小弟现在是十万火急,望各位大峡不吝赐教,不胜感激!!!!!!
procedure Tinputteacher.Button1Click(Sender: TObject);
var
id1,id2,id3:integer;
begin
//DataModule2.dsinputteacher.DataSet.edit;
//DataModule2.dsinputteacher.DataSet.Post;
//DataModule2.dsinputteacher.DataSet.insert;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('teachername').value
:=edit1.Text;
datamodule2.ADODataSetlesson.Open;
datamodule2.ADODataSetlesson.Locate
('lsnname',VarArrayOf([DBLookupComboBox3.Field]),[loPartialKey]);
id1:=datamodule2.ADODataSetlesson.fieldbyname('lessonid').Value;
datamodule2.ADODataSetlesson.Locate
('lsnname',VarArrayOf([DBLookupComboBox4.Field]),[loPartialKey]);
id2:=datamodule2.ADODataSetlesson.fieldbyname('lessonid').Value;
datamodule2.ADODataSetlesson.Locate
('lsnname',VarArrayOf([DBLookupComboBox5.Field]),[loPartialKey]);
id3:=datamodule2.ADODataSetlesson.fieldbyname('lessonid').Value;
datamodule2.ADODataSetlesson.close;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('lessonid1').value
:=id1;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('lessonid1').value
:=id2;
DataModule2.ADODataSetlklsn.Parameters.ParamByName('lessonid1').value
:=id3;
datamodule2.ADODataSetlklsn.ExecSQL;
end;
调试时在三个locate函数处报错
“incompatible types:'variant' and 'tfield'” 和
“incompatible types:'tlocateoption' and'integer'”
请问是什么原因,是不是locate函数有错?
小弟现在是十万火急,望各位大峡不吝赐教,不胜感激!!!!!!