各位大虾;
我在在运行以下程序时,系统提醒我'DataSet not in Edit
or Insert mode',我查了几遍都为查处问题。请哪为高手帮我一个忙。
以下便是经过简化的源代码:(ERP:用InterBase开发的数据库的别名。CustomerGrade:库中的一个表。)
object Form1: TForm1
Left = 192
Top = 112
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 120
TextHeight = 16
object DBGrid1: TDBGrid
Left = 48
Top = 136
Width = 529
Height = 129
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -13
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object Table1: TTable
DatabaseName = 'ERP'
TableName = 'CUSTOMERGRADE'
Left = 48
Top = 80
end
object DataSource1: TDataSource
DataSet = Table1
Left = 112
Top = 80
end
endunit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, DBTables;type
TForm1 = class(TForm)
Table1: TTable;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Table1.Active:=true;
Table1.Last;
Table1.FieldValues['ID']:='005';
Table1.Post;
Table1.Active:=false;
end;end.
我在在运行以下程序时,系统提醒我'DataSet not in Edit
or Insert mode',我查了几遍都为查处问题。请哪为高手帮我一个忙。
以下便是经过简化的源代码:(ERP:用InterBase开发的数据库的别名。CustomerGrade:库中的一个表。)
object Form1: TForm1
Left = 192
Top = 112
Width = 696
Height = 480
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 120
TextHeight = 16
object DBGrid1: TDBGrid
Left = 48
Top = 136
Width = 529
Height = 129
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -13
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object Table1: TTable
DatabaseName = 'ERP'
TableName = 'CUSTOMERGRADE'
Left = 48
Top = 80
end
object DataSource1: TDataSource
DataSet = Table1
Left = 112
Top = 80
end
endunit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, Grids, DBGrids, DBTables;type
TForm1 = class(TForm)
Table1: TTable;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
Table1.Active:=true;
Table1.Last;
Table1.FieldValues['ID']:='005';
Table1.Post;
Table1.Active:=false;
end;end.
解决方案 »
- 使用TServerSocket和TClientSocket时,如果操作系统是Win2003,哪方面应注意?
- 如何在delphi用鼠标移动多个edit
- 请问win2k,winxp,2003下如何读取bios的序列号!
- 如何用query组件,来执行存储过程???存储过程有结果返回,如何取得呢?急。。。。。。。。。。。。。。。。。。
- 求能在CLX下面用的串口通信控件~~~
- 真的不明白,请大家帮帮忙
- RichEdit的Bug警告(级别:中级)
- Delphi5.0下生成的bpl文件可否安装在Delphi6.0下?
- adoconnection的openschema问题,在线等待
- delphi能写dll吗?
- 在线等待,关于Delphi,MSSQL
- 如何添加键盘接口?
Table1.Active:=true;
Table1.Last;
//add
Table1.Edit;
Table1.FieldValues['ID']:='005';
Table1.Post;
Table1.Active:=false;
Table1.Last;
//add
Table1.Insert;
Table1.FieldValues['ID']:='005';
Table1.Post;
Table1.Active:=false;