我在对ADOtable初始化是由以下代码,想根据不同的DataSource动态的给DBgrid加上Title,但运行中老提示“list index out of Bounds(0)”, 换成Add好像也不行!
各位请问该如何是好????with adotable_sttype do
begin
Connection :=data_dbconn.adoconn_db;
TableName :='T_STTYPE';
Fields[0].FieldName:='sttype_id';
Fields[1].FieldName:='sttype_name';
Fields[2].FieldName:='sttype_score';
Fields[0].DisplayLabel :='type';
Fields[1].DisplayLabel :='name';
Fields[2].DisplayLabel :='score';
Filter:='sttype_name<>'''+'''';
Filtered :=true;
Open ;
datasource_sttype.DataSet :=adotable_sttype;
end;
各位请问该如何是好????with adotable_sttype do
begin
Connection :=data_dbconn.adoconn_db;
TableName :='T_STTYPE';
Fields[0].FieldName:='sttype_id';
Fields[1].FieldName:='sttype_name';
Fields[2].FieldName:='sttype_score';
Fields[0].DisplayLabel :='type';
Fields[1].DisplayLabel :='name';
Fields[2].DisplayLabel :='score';
Filter:='sttype_name<>'''+'''';
Filtered :=true;
Open ;
datasource_sttype.DataSet :=adotable_sttype;
end;
解决方案 »
- 有人用过LibTiffDelphi吗?
- 如何响应动态创建的控件数组中一个控件的事件?
- 请问怎么用delphi判断c:\11里面有没有文件。包括这个文件夹是否存在
- 请问谁用过遗传算法,开发排课系统,谢谢指教了。。。
- 不明白,有没有人知道?
- 高手在上,请问怎么样在win2k中实现关闭程序和绘图[内详]
- 将fsMDIChild类型窗体设为windowstate设为最大化,怎么出来的时候会有一个最大化过程?
- 在Reportbuilder中,主从表的问题?
- 求一office2000的序列号,谢谢!
- >>> 如何实现把一副 .bmp,.jpg格式的图片存入paradox表中???
- 关于帮助文件的调用
- 如何制作向 TActionList -> TAction 这样的控件?
Fields[0].FieldName:='sttype_id';
Fields[1].FieldName:='sttype_name';
Fields[2].FieldName:='sttype_score';
Fields[0].DisplayLabel :='type';
Fields[1].DisplayLabel :='name';
Fields[2].DisplayLabel :='score';
有没有第三列呢?如果出错是如你所述的话,原因可能就是在此了:没有第三列而你却引用第三列的属性,所以会出错!去掉两个fields[2]的引用吧!
jpyc(智若愚) 同志:你没由明白我得意思,若是Dbgrid与Adotable一对一,我当然知道那样做了!问题是一对多!