http://www.delphi2007.net/DelphiDB/html/delphi_20061220215617197.html
exhiStr:='SELECT a.enterpid as enterpid, a.enterpname, a.enterpaddr, a.enterpzip, a.enterptel, a.enterpfax, ' +
'a.enterpemail,a.enterpweb,a.enterptype, a.enterpsize, a.enterpnature, a.enterpmemo, a.prid, ' +
'a.prname, a.cldid, a.cldname, a.personid, a.personname, a.personjobs, b.prjenterpid, b.prjid, ' +
'b.userid, b.enterpimp, b.prjenterpinsdate, b.prjenterpupddate, b.personmain, c.prjname' +
' FROM venterpandperson a, prjenterpinfo b, projectinfo c ' +
' WHERE (((a.enterpid = b.enterpid) AND (b.prjid = c.prjid)) AND (a.personid = b.personid))';
RzDBGrid1.DataSource:=DM.DSListEnterp;
{DM.DSListEnterp.DataSet:=DM.DQListEnterp;}
DM.DQListEnterp.Close;
DM.DQListEnterp.sql.clear;
DM.DQListEnterp.SQL.Add(exhiStr);
DM.DQListEnterp.Open ;
{enterpStr:=;}
DM.DQenterpmore.DataSource:=DM.DSListEnterp;
DM.DQenterpmore.Close;
DM.DQenterpmore.SQL.Clear;
DM.DQenterpmore.SQL.Add('select enterpid,enterpname from enterpinfo where enterpid =:enterpid');
DM.DQenterpmore.Prepared :=true;
DM.DQenterpmore.Open;
上面这样的代码,总是报parameter object is improperly defined的错误
请问是什么原因导致的这样的错误呢?
没有人碰到过这种情况吗.
主从表不是这样做的,Delphi的Demo中有例子,可先看看
你的错误在这一行,设置了:enterpid参数,却没给参数赋值,就打开Query,所以报错了
DM.DQenterpmore.SQL.Add('select enterpid,enterpname from enterpinfo where enterpid =:enterpid');
DEMO里是用ADODATASET来做的,用ADOQUERY不可以吗?
{DM.DSListEnterp.DataSet:=DM.DQListEnterp;}
老大, 这句话 为什么 注释掉?
拿掉后, 应该 就可以了。
我记得主从表很好做的,对ADOQUARY的SQL语句写完整后,设置一个主面一个从面就可以了
DM.DQenterpmore.SQL.Add('select enterpid,enterpname from enterpinfo where enterpid =:enterpid');
这句,设了参数,后面赋值