to focus 我在窗體二的formshow中執行窗體一.free和在sql.add('select count(i) as MyCount from cgdindantou where i=:par1')這句話前面執行窗體一.free,但還是出現未找到窗體一中dbedit所指定的字段,還請更明確指點,謝謝﹗
這是form1的代碼 //自動產生日期和單號 decodedate(now,year,month,day); //統計本月的單號﹐自動增加單號 dinhufindform.dbedit6.Free; with data1.cgdindantouq do begin sql.Clear; sql.add('select count(i) from cgdindantou where i=:par1'); params[0].asstring:=inttostr(year)+inttostr(month); open; end; data1.cgdindantou.append; panel5.caption:=inttostr(year)+inttostr(month)+inttostr(day)+inttostr (data1.cgdindantouq.fieldbyname('expr1000').asinteger+1); 另外form2中的formshow中的代碼﹕ with data1.cgdindantouq do begin if requestlive=false then requestlive:=true; sql.clear; sql.add('select * from cgdindantou'); open; end; //把采購訂單體與采購訂單頭相關聯起來 data1.cgdindanti.MasterSource:=data1.cgdindantoudataq; data1.cgdindanti.MasterFields:='訂單號'; data1.cgdindanti.Open;在form2中我用了dbedit,並把它們分別指向cgdindantouq中的相應字段 但我在執行form1上面的那代碼﹐便總出錯找不到dbedit中所指的字段。
老兄﹐幫忙指點一下迷津,一定把分送上門來,謝謝﹗
但你肯定是已创建了它
你在修改sql的时候必须先free掉一
这样才不会出错
主要还是因为
dbedit没有找到sql中相应的字段的原因
我在窗體二的formshow中執行窗體一.free和在sql.add('select count(i) as MyCount from cgdindantou where i=:par1')這句話前面執行窗體一.free,但還是出現未找到窗體一中dbedit所指定的字段,還請更明確指點,謝謝﹗
//自動產生日期和單號
decodedate(now,year,month,day);
//統計本月的單號﹐自動增加單號
dinhufindform.dbedit6.Free;
with data1.cgdindantouq do
begin
sql.Clear;
sql.add('select count(i) from cgdindantou where i=:par1');
params[0].asstring:=inttostr(year)+inttostr(month);
open;
end;
data1.cgdindantou.append;
panel5.caption:=inttostr(year)+inttostr(month)+inttostr(day)+inttostr (data1.cgdindantouq.fieldbyname('expr1000').asinteger+1);
另外form2中的formshow中的代碼﹕
with data1.cgdindantouq do
begin
if requestlive=false then requestlive:=true;
sql.clear;
sql.add('select * from cgdindantou');
open;
end;
//把采購訂單體與采購訂單頭相關聯起來
data1.cgdindanti.MasterSource:=data1.cgdindantoudataq;
data1.cgdindanti.MasterFields:='訂單號';
data1.cgdindanti.Open;在form2中我用了dbedit,並把它們分別指向cgdindantouq中的相應字段
但我在執行form1上面的那代碼﹐便總出錯找不到dbedit中所指的字段。
也不够全
如果发过来我定能解决
如果不行的话
还有一个办法
那就是
query.disablecontrols;
这个可以断开和dbedit的连接
query.enablecontrols;恢复