本文整理自网络,侵删。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Edit1: TEdit;
Label1: TLabel;
Button3: TButton;
ADOQuery1: TADOQuery;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
str:Array[1..100]of String;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
k,b:Integer;
begin
if edit1.Text<>'' then
begin
b:=strtoint(edit1.Text);
for k:=1 to b do
begin
str[k]:=InputBox('请输入成绩',pchar('第'+inttostr(k)+'位'),'0');
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
m,b:Integer;
begin
b:=strtoint(edit1.Text);
for m:=1 to b do
begin
Form1.Canvas.TextOut(30,30*m,str[m]);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
m,b:Integer;
begin
b:=strtoint(edit1.Text);
for m:=1 to b do
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('insert into 测试 values(:a)');
parameters.ParamByName('a').Value:=str[m];
execsql;
end;
end;
showmessage('存储成功!');
end;
end.
相关阅读 >>
Delphi twebbrowser:确定带有框架的页面何时完成
Delphi f1026 file not found: ''quickrpt.dcu''解决方法
Delphi dateutils.ispm - 判断时间是否是下午
Delphi windows 下用 Delphi 代码杀死进程,或者杀死自己
Delphi 将image组件的图片保存为jpg格式图片方法
Delphi strtofloat 将“字符型”转换成“浮点型”
更多相关阅读请进入《Delphi》频道 >>