我在用ADOTABLE 操作的过程中,用APPEND,正常,可是只要一POST,就报错,错误提示如下
project prj.exe raised exception class eoleexception with message' 多步操作产生错误。请检查每一步的状态值。'
那位高手能指点一下啊?
代码如下unit Unit_input;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, twEnter, Grids, DBGridEh, StdCtrls, DBCtrls, Mask,
DBCtrlsEh, Menus, DB, Buttons, ImgList;type
TFrminput = class(TForm)
panelbotton: TPanel;
Paneltop: TPanel;
TWEnter1: TTWEnter;
DBGridEh1: TDBGridEh;
DBE_no: TDBEditEh;
DBE_yinfu: TDBEditEh;
DBE_shifu: TDBEditEh;
DBTweifu: TDBText;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
BtnOk: TButton;
Splitter1: TSplitter;
dsinput: TDataSource;
Button1: TButton;
btnnew: TButton;
Label5: TLabel;
DBNavigator1: TDBNavigator;
SpeedButton1: TSpeedButton;
DBE_weifu: TDBEditEh;
procedure DBE_shifuExit(Sender: TObject);
procedure BtnOkClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure btnnewClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
suser:string;
{ Public declarations }
end;var
Frminput: TFrminput;implementationuses Unit_data, Unit_login;{$R *.dfm}procedure TFrminput.DBE_shifuExit(Sender: TObject);
begin
{if StrToCurr(dbe_yinfu.Text) - StrToCurr(DBEshifu.Text) > 0 then
begin
DBTweifu.font.Color:=clred;
DBTweifu.font.Size:=10;
DMmain.ADTinput.FieldByName('zhaohui').AsCurrency:=StrToCurr(dbe_yinfu.Text) - StrToCurr(DBEshifu.Text);
end
else
DMmain.ADTinput.FieldByName('zhaohui').AsCurrency:=0 ; }
end;procedure TFrminput.BtnOkClick(Sender: TObject);
begin
DMmain.adtinput.Post;
end;procedure TFrminput.Button1Click(Sender: TObject);
begin
label1.Caption:=suser;
end;procedure TFrminput.btnnewClick(Sender: TObject);
begin
DMmain.adtinput.Edit;
DMmain.adtinput.Append;
DMmain.adtinput.FieldByName('caozuoyuan').AsString:=FrmLogin.suser;
end;procedure TFrminput.FormCreate(Sender: TObject);
begin
frminput.WindowState:=wsmaximized;
if not DMmain.ADTinput.Active =True then
DMmain.ADTinput.Active:= true;end;end.
project prj.exe raised exception class eoleexception with message' 多步操作产生错误。请检查每一步的状态值。'
那位高手能指点一下啊?
代码如下unit Unit_input;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, twEnter, Grids, DBGridEh, StdCtrls, DBCtrls, Mask,
DBCtrlsEh, Menus, DB, Buttons, ImgList;type
TFrminput = class(TForm)
panelbotton: TPanel;
Paneltop: TPanel;
TWEnter1: TTWEnter;
DBGridEh1: TDBGridEh;
DBE_no: TDBEditEh;
DBE_yinfu: TDBEditEh;
DBE_shifu: TDBEditEh;
DBTweifu: TDBText;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
BtnOk: TButton;
Splitter1: TSplitter;
dsinput: TDataSource;
Button1: TButton;
btnnew: TButton;
Label5: TLabel;
DBNavigator1: TDBNavigator;
SpeedButton1: TSpeedButton;
DBE_weifu: TDBEditEh;
procedure DBE_shifuExit(Sender: TObject);
procedure BtnOkClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure btnnewClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
suser:string;
{ Public declarations }
end;var
Frminput: TFrminput;implementationuses Unit_data, Unit_login;{$R *.dfm}procedure TFrminput.DBE_shifuExit(Sender: TObject);
begin
{if StrToCurr(dbe_yinfu.Text) - StrToCurr(DBEshifu.Text) > 0 then
begin
DBTweifu.font.Color:=clred;
DBTweifu.font.Size:=10;
DMmain.ADTinput.FieldByName('zhaohui').AsCurrency:=StrToCurr(dbe_yinfu.Text) - StrToCurr(DBEshifu.Text);
end
else
DMmain.ADTinput.FieldByName('zhaohui').AsCurrency:=0 ; }
end;procedure TFrminput.BtnOkClick(Sender: TObject);
begin
DMmain.adtinput.Post;
end;procedure TFrminput.Button1Click(Sender: TObject);
begin
label1.Caption:=suser;
end;procedure TFrminput.btnnewClick(Sender: TObject);
begin
DMmain.adtinput.Edit;
DMmain.adtinput.Append;
DMmain.adtinput.FieldByName('caozuoyuan').AsString:=FrmLogin.suser;
end;procedure TFrminput.FormCreate(Sender: TObject);
begin
frminput.WindowState:=wsmaximized;
if not DMmain.ADTinput.Active =True then
DMmain.ADTinput.Active:= true;end;end.
解决方案 »
- 求一简单算法
- 敬請賜教 oracle 問題
- 有在深圳的DElPHI高手么 公司内部自己开发的erp需要修改
- 请兼职Delphi程序员,要求有两年以上开经验。
- 请问如何建立ADO的事务处理?
- 紧急求助啊?高分香送,高手帮忙啊~~~十万火急啊
- 如何删除文件啊?大家帮帮我好不好???
- 推荐一款最新实用软件
- 一个超级疑难问题,直接叫板Delphi版主(不要嫌分数少) 只要解决问题,将我的全部家当全给都成!
- Delphi数据库软件的安装程序需要配置哪些文件?为什么我的数据库安装程序不能用,望赐教
- 请教大家:ADO与线程的问题!如何在一个线程中使用ADO组件?
- 在诺顿的网络监测软件中,服务器端显示的是133.30.1.6:http-alt,是什么端口?
改成DMmain.adtinput.FieldByName('caozuoyuan').value:=FrmLogin.suser;试试呢
或者是不是赋值的时候数据类型不匹配啊 还是存在不允许空的字段啊
if DMmain.adtinput.state in [dsInsert] then //好象是这样
DMmain.adtinput.Post;我也不大清楚,随便说说,呵呵
append后在dbgrid中不要移动行,一移动,就会自动post,你再通过按钮来post时,表已经不处于编辑状态,所以报错,
将DMmain.adtinput.Post;放到btnnewclick后面
我以前碰到这样的事情,可能是数据库设置问题,比如主键问题,或者有相同记录问题(删除出错),也就是着几个方面的问题,检查一下,基本就ok了