在FORM1中,用QUERY和DATESOURCE控件,把查询的结果放入DBGRID中,怎么样才能在查询结果中定位查找某条记录?忘各位大哥帮忙指点,谢谢,在线等!
解决方案 »
- Delphi7的"Invalid pointer operation"异常的解决办法
- 新手上路,ACCESS数据(日期)在DBGRID中显示时提示错误
- table控件的Filter问题(弱问)
- 请教:应用程序怎样调用软键盘? 在线等!!!
- 如果连接不上SQL SERVER数据库的话,能不能不弹出错误窗口
- 问个数据库统计的问题
- 为什么在WIN2000下编的程序与WIN98下的界面不一样,有什么解决的方法?
- 新手上路,DELPHI是比VC更有生产力的工具。
- 如何将PRODRAX数据库转换到ORACLE8i中?
- 如何用Ado连接ACESS库?
- 动态生成的BUTTON如何移动?
- 大家帮忙写个打开组策略的小程序好吗
QUERY1.Locate('Name','Jack',[]);
其中VALUE为变量怎么办?
value: string;
begin
value := 'Jack';
QUERY1.Locate('KeyField',value,[]);
不能给变量,还有别的方法可以搞定吗?
你加个TEDIT试一下就知道了
QUERY1.Locate('KeyField',Edit1.Text,[]);
QUERY1.Locate('KeyField',Edit1.Text,[]);
这样会跳到第一行去
EDIT1.TEXT:=FORM2.EDIT1.TEXT;
QUERY1.Locate('KeyField',Edit1.Text,[]);
这样会报错是怎么回事啊??
var
value: string;
beginForm_in_storage_detail.Edit2.Text:= DBGrid_regimentation.DataSource.DataSet.Fields[1].AsString ;
value:=Form_in_storage_detail.Edit2.Text; if Form7=nil then
Form7:=TForm7.Create(nil);
if Form7.Query_search_goods.Active then
Form7.Query_search_goods.close ;
Form7.Query_search_goods.ParamByName('goods_id').AsString:=form_in_storage_detail.EDIT2.Text+'%';
Form7.Query_search_goods.Open; form_in_storage_detail.edit2.Text:=form7.DBGrid_regimentation.Fields[0].AsString;
form_in_storage_detail.edit3.Text:=form7.DBGrid_regimentation.Fields[2].AsString;
form_in_storage_detail.edit4.Text:=form7.DBGrid_regimentation.Fields[4].AsString;
form_in_storage_detail.edit5.Text:=form7.DBGrid_regimentation.Fields[5].AsString;
form_in_storage_detail.edit6.Text:=form7.DBGrid_regimentation.Fields[6].AsString; if trim(form_in_storage_detail.edit2.text)='01' then
begin form_in_storage_detail.EDIT2.Text:='昌力'
end;
if trim(form_in_storage_detail.edit2.text)='02' then
begin form_in_storage_detail.EDIT2.Text:='昌力三分厂'
end;
if trim(form_in_storage_detail.edit2.text)='04' then
begin form_in_storage_detail.EDIT2.Text:='长力'
end;
if trim(form_in_storage_detail.edit2.text)='03' then
begin form_in_storage_detail.EDIT2.Text:='昌力分厂'
end;
if trim(form_in_storage_detail.edit2.text)='05' then
begin form_in_storage_detail.EDIT2.Text:='昌力定做'
end;
form_in_storage_detail.DBGD_in_storage_detail.DataSource.DataSet.Append;form_in_storage_detail.DBGD_in_storage_detail.Fields[0].AsString:=form_in_storage_detail.edit2.Text;
form_in_storage_detail.DBGD_in_storage_detail.Fields[1].AsString:=form_in_storage_detail.edit4.Text;
form_in_storage_detail.DBGD_in_storage_detail.Fields[2].AsString:=form_in_storage_detail.edit5.Text;
form_in_storage_detail.DBGD_in_storage_detail.Fields[3].AsString:=form_in_storage_detail.edit6.Text;
if Query_search_goods.Active then
Query_search_goods.Close;
Query_search_goods.ParamByName('goods_subject').AsString:=PNodeData(treeview_regimentation.Selected.Data)^.node_id;
Query_search_goods.ParamByName('goods_category').AsString:='%';
Query_search_goods.ParamByName('goods_project').AsString:='%';
Query_search_goods.ParamByName('goods_name').AsString:=trim(ed_name.Text)+'%';
Query_search_goods.ParamByName('goods_specification').AsString:=trim(ed_guige.text)+'%';
Query_search_goods.ParamByName('goods_place').AsString:=trim(Ed_place.Text)+'%';
Query_search_goods.ParamByName('goods_id').AsString:=edit1.Text+'%'; Query_search_goods.Prepare; Query_search_goods.Open;
Query_search_goods.Locate('GOODS_ID','value',[]);end;
你写'value'当然不行啦!你想根据那个字段去查!晕,原代码更加恐怖,乱!!我说兄台,你不用会用
with...do语句吗?