//導入exceltosql
var
sql : string;
begin
adoquery1.close; //adoquery1?接sqlserver的connection
adoquery1.sql.clear; //清空sql
sql:=insert into tbl1(id,name,sex,ph,adat) select id,name,sex,ph,adat from openrowset(microsoft.jet.oledb.4.0,excel 5.0;hdr=yes;database=d:\d.xls,sheet1$) ;//sheet1$要求的excel表格
adoquery1.sql.add(sql);//?行sql
adoquery1.execsql;
end;
var
sql : string;
begin
adoquery1.close; //adoquery1?接sqlserver的connection
adoquery1.sql.clear; //清空sql
sql:=insert into tbl1(id,name,sex,ph,adat) select id,name,sex,ph,adat from openrowset(microsoft.jet.oledb.4.0,excel 5.0;hdr=yes;database=d:\d.xls,sheet1$) ;//sheet1$要求的excel表格
adoquery1.sql.add(sql);//?行sql
adoquery1.execsql;
end;