delphi 用input连续记录所输入的次数


本文整理自网络,侵删。

  

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版插apc杀进程驱动源码

Delphi 开发中遇到的dll问题思考及解决方法

Delphi dateutils.ispm - 判断时间是否是下午

Delphi重写一个字符串分割函数

Delphi windows 下用 Delphi 代码杀死进程,或者杀死自己

Delphi整理二(object pascal语言)

Delphi 将image组件的图片保存为jpg格式图片方法

Delphi strtofloat 将“字符型”转换成“浮点型”

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...