procedure TForm1.Button1Click(Sender: TObject);
begin
if adoconnection1.InTransaction then adoconnection1.CommitTrans;
ADOConnection1.BeginTrans;
try
ADODataSet1.next;//不断的换行修改
ADODataSet1.Edit;
ADODataSet1.Fields[1].AsString:='2222';
ADODataSet1.Post;
adoconnection1.CommitTrans;
except
adoconnection1.RollbackTrans;
end;
_______________object Form1: TForm1
Left = 192
Top = 107
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 232
Top = 160
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Panel1: TPanel
Left = 216
Top = 56
Width = 185
Height = 41
Caption = 'Panel1'
TabOrder = 1
end
object Edit1: TEdit
Left = 40
Top = 136
Width = 121
Height = 21
TabOrder = 2
Text = 'Edit1'
end
object Button2: TButton
Left = 88
Top = 200
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 3
end
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:/My' +
' Documents/db1.mdb;Mode=Share Deny None;Extended Properties="";J' +
'et OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB' +
'
atabase Password="";Jet OLEDB:Engine Type=5;Jet OLEDB
atabase' +
' Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Gl' +
'obal Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet ' +
'OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=Fa' +
'lse;Jet OLEDB
on'#39't Copy Locale on Compact=False;Jet OLEDB:Compa' +
'ct Without Replica Repair=False;Jet OLEDB:SFP=False'
LoginPrompt = False
Mode = cmShareDenyNone
Provider = 'Microsoft.Jet.OLEDB.4.0'
Left = 88
Top = 48
end
object ADODataSet1: TADODataSet
Active = True
Connection = ADOConnection1
CursorLocation = clUseServer
CommandText = 'select * from xyz'
Parameters = <>
Left = 128
Top = 48
end
end