新手求教,help!
一个向SQL数据库自动添加数据的程序
与数据库显示都很没有问题,可是为什么我的
SQL语句老出错,搞了两天了
郁闷
请大家指教,谢谢!!
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, Grids, DBGrids, ADODB;
type
TForm1 = class(TForm)
ADOQuery1: TADOQuery;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j,k,m,n:Integer;
const
ho:array[0..4] of pchar=('红','绿','黄','白','蓝');
pe:array[0..4] of pchar=('狗','鸟','鱼','马','猫');
dr:array[0..4] of pchar=('茶','咖啡','牛奶','啤酒','水');
ci:array[0..4] of pchar=('PALL','DUN','BLEN','BLUE','PRIN');
na:array[0..4] of pchar=('英国','瑞典','丹麦','挪威','德国');
begin
for i:=0 to 4 do begin
if i=5 then break;
for j:=0 to 4 do begin
if j=5 then break;
for k:=0 to 4 do begin
if k=5 then break;
for m:=0 to 4 do begin
if m=5 then break;
for n:=0 to 4 do begin
if n=5 then
break;
with ADOQuery1 do
begin
if Active then Close;
SQL.Clear;
SQL.Add('INSERTINTO northwind.dbo.problem (house,pet,drink,cigarette,nationality) VALUES (" "," "," "," "," ")');
ExecSQL; Open 。
end;
end;
end;
end;
end;
end;
end;
end.