三层结构,client 端用 clientdataset1 -->Datasource1--> DBGrideh1 显示数据表,然后动态创建一个 clientdataset:tempCDS,从另一个 table query 数据并动态给第四列加入 picklist和 keylist,实现了该列的下拉只选列表,但是点选下拉值后,并 clientdataset1.applyupdate(0)时,总是出现 “ora-00904: invalid column name” 的错误。为什么啊?高手帮忙啊?
下面是动态添加 picklist 和 keylist 的代码: tempCDS := TClientDataSet.Create(self);
tempCDS.commandText := 'select * from status';
tempCDS.Open ;
DBGridEh1.Columns[3].AlwaysShowEditButton := True;
DBGridEh1.Columns[3].KeyList.Clear;
DBGridEh1.Columns[3].PickList.Clear;
tempCDS.First ;
while not tempCDS.Eof do
begin
DBGridEh1.Columns[3].KeyList.Add(tempCDS.Fields[0].AsString);
DBGridEh1.Columns[3].PickList.Add(tempCDS.Fields[1].AsString);
tempCDS.Next ;
end;
tempCDS.Close ;
tempCDS.Free ;
下面是动态添加 picklist 和 keylist 的代码: tempCDS := TClientDataSet.Create(self);
tempCDS.commandText := 'select * from status';
tempCDS.Open ;
DBGridEh1.Columns[3].AlwaysShowEditButton := True;
DBGridEh1.Columns[3].KeyList.Clear;
DBGridEh1.Columns[3].PickList.Clear;
tempCDS.First ;
while not tempCDS.Eof do
begin
DBGridEh1.Columns[3].KeyList.Add(tempCDS.Fields[0].AsString);
DBGridEh1.Columns[3].PickList.Add(tempCDS.Fields[1].AsString);
tempCDS.Next ;
end;
tempCDS.Close ;
tempCDS.Free ;
解决方案 »
- 用delphi 2007编译后运行报错:An error occurred while attempting to initialize the Borland Database Engine(error $2108)
- 请问哪里有Delphi7.0的安装程序
- 为什么我的web server application程序没有错误,发布后(本机调试)显示该网页无法显示?
- 只用DELPHI真的太单一了,我要尝试作网站,想搞搞ASP或ASP.NET,但不知ASP和ASP.NET到底有何差异???望指点
- 急!简单问题!
- delphi中怎样用插件的,在线等。
- 誰知道哪有李維著的delphi5系列書下載網站(免費)
- 去哪找rnaui.dll啊?
- 关于IE Twebbrowser的问题??
- 那里能DOWN到大富翁的离线数据库啊?
- 请问在IC卡中可以存储除字符串以外的其他数据类型吗?
- button无法正常显示
tempCDS.ProviderName := ClientDataSet1.ProviderName ;
tempCDS.packetRecords := -1;已经设了。哪里出错啊?急啊!!!
在ClientDataSet1的onReconcileError事件中HandleReconcileError(DataSet,UpdateKind,E);(其中HandleReconcileError是TReconcileErrorForm的函数)
看看错误信息是什么
......
tempCDS := TClientDataSet.Create(self);
tempCDS.RemoteServer := ClientDataSet1.RemoteServer;
tempCDS.ProviderName := ClientDataSet1.ProviderName ;
tempCDS.packetRecords := -1;
tempCDS.fetchOnDemand := False;
tempCDS.beforegetrecords := cdsbeforegetrecords;
SQLStr := 'select * from status';
tempCDS.Open ;
DBGridEh1.Columns[3].AlwaysShowEditButton := True;
DBGridEh1.Columns[3].KeyList.Clear;
DBGridEh1.Columns[3].PickList.Clear;
tempCDS.First ;
while not tempCDS.Eof do
begin
DBGridEh1.Columns[3].KeyList.Add(tempCDS.Fields[0].AsString);
DBGridEh1.Columns[3].PickList.Add(tempCDS.Fields[1].AsString);
tempCDS.Next ;
end;
tempCDS.Close ;
tempCDS.Free ;
......//下面是beforegetrecords events
procedure TForm1.cdsbeforegetrecords(Sender : TObject; var OwnerData : OleVariant);
var LastValue : OleVariant;
begin
LastValue := Null;
ownerdata := VarArrayOf([SQLStr, LastValue ]);
end;//下面是一开始打开 DBGridEh 连接的 ClientDataSet1 的过程:
procedure TForm1.ShowBtnClick(sender : TObject);
begin
ClientDataSet1.beforegetrecords := cdsbeforegetrecords;
SQLStr := 'select * from PInfo';
ClientDataSet1.open;
end;
......
高人救命啊!!!急用。帮帮我这个无助的人吧!!!
tempCDS.ProviderName := ClientDataSet1.ProviderName ;因为tempCDS和ClientDataSet1使用了同一个ProviderName ,当tempCDS打开后改变了中间层(ClientDataSet1.ProviderName )的记录集!,重新在中间层为tempCDS加一个ProviderName