[此贴子已经被作者于2005-7-7 13:16:33编辑过]
[此贴子已经被作者于2005-7-7 13:16:33编辑过]
将刚才的用delphi编写程序有作了修改,下面这个程序对单表操作习惯更具代表性;
程序和代码下载 http://www.daizhicun.com/dmx/dai/delphiToCS1.rar
代码如下:
unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, Grids, DBGrids, DBCtrls, DB, ADODB, StdCtrls, Buttons, Mask;
type TForm1 = class(TForm) ADOConnection1: TADOConnection; ADOQuery1: TADOQuery; DataSource1: TDataSource; DBGrid1: TDBGrid; Panel1: TPanel; Panel2: TPanel; BitBtn1: TBitBtn; BitBtn2: TBitBtn; BitBtn3: TBitBtn; BitBtn4: TBitBtn; BitBtn5: TBitBtn; BitBtn6: TBitBtn; GroupBox1: TGroupBox; DBEdit1: TDBEdit; DBEdit2: TDBEdit; Label1: TLabel; Label2: TLabel; procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure BitBtn3Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); procedure BitBtn4Click(Sender: TObject); procedure BitBtn5Click(Sender: TObject); procedure BitBtn6Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); begin ADOQuery1.SQL.Text := 'select * from 表1'; ADOQuery1.Open;
end;
procedure TForm1.BitBtn1Click(Sender: TObject); begin ADOQuery1.Insert; end;
procedure TForm1.BitBtn3Click(Sender: TObject); begin ADOQuery1.Edit; end;
procedure TForm1.BitBtn2Click(Sender: TObject); begin ADOQuery1.Delete; end;
procedure TForm1.BitBtn4Click(Sender: TObject); begin ADOQuery1.Post; end;
procedure TForm1.BitBtn5Click(Sender: TObject); begin ADOQuery1.Cancel; end;
procedure TForm1.BitBtn6Click(Sender: TObject); begin Close; end;
end.
我发布代码的意思是:用delphi开发真的非常简单,不知道用C#如何开发,是不是比它还要简单。