我做了个多层的数据库应用软件,服务器端放了TADOConnection、TADOQuery、TDataSetProvider;客户端放了TSocketConnection、TClientDataSet1、TDataSource;现在访问和修改数据都很正常,但在添加记录时会提示服务器端的数据集出现错误:Cannot perform this operation on an open dataset。如果说要关闭该数据集则如何关闭?但如果是多用户则又如何解决(关闭该数据集后可能会影响他人使用)?高分求解(分不够再加)。代码如下:
sql:='Insert into Personinfo (TypeMark,Name,EName) value(';
sql:=sql+Edit1.Text+',';
sql:=sql+Edit2.Text+',';
sql:=sql+Edit3.Text+')';
DataModule1.ClientDataSet1.Close;
DataModule1.ClientDataSet1.CommandText:=sql;
DataModule1.ClientDataSet1.Execute;
sql:='Insert into Personinfo (TypeMark,Name,EName) value(';
sql:=sql+Edit1.Text+',';
sql:=sql+Edit2.Text+',';
sql:=sql+Edit3.Text+')';
DataModule1.ClientDataSet1.Close;
DataModule1.ClientDataSet1.CommandText:=sql;
DataModule1.ClientDataSet1.Execute;
解决方案 »
- 怎么在指定时间画出某图?
- Cookie问题
- hook(钩子) 的DLL 文件如何使用
- 用了TQRCompositeReport后怎么让每个加入的报表都从新的页开始打印?
- quickreport中分组统计如何打?
- 寻求Delphi6 Update 2# pack
- Stringgrid做出来得列表如何在它左边增加对错号得单选框?
- 在Delphi下不用QuickReport打印DBgrid的话,应如何做?help!!!
- 谁有Turbo Pascal?
- Delphi 7中 TIdUDPServer 的接收端怎么写代码?
- 如何解决Data Field not permitted to open Dataset!
- 高分请教,请问怎样在DELPHI下调用dos命令???
2. The provider receives a BeforeExecute event, where the OleVariant from the client dataset appears as the OwnerData parameter. The provider can respond to or change that information before passing the execute command on to its dataset.
3. The provider dispatches its Execute method to execute a query or stored procedure.
4. The provider receives an AfterExecute event, where it can encode custom information into its OwnerData parameter or respond to information from the BeforeExecute event handler.5. The client dataset receives an AfterExecute event, where it can respond to the custom information returned by the provider in its AfterExecute event handler.
而且其sql属性不能为空,该填的还得填,