name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency">
procedure TFmMain.BtngoClick(Sender: TObject);
var
txtfile : TextFile;
txtstr,tmpstr : string;
id,Num,L_ID,U_ID,U_Name : string;
s : integer;
begin
//连接数据库
con.Connected := false;
con.KeepConnection := true;
con.Connected := true;
dataset.Active := false;
dataset.CommandText := 'select * from txttable ';
try
dataset.Open;
except
dataset.Active := false;
end;
//读取文本文件
txtstr := trim(EText.Text);
if fileexists(txtstr) then
begin
AssignFile(txtfile,txtstr);
Reset(txtfile);
while not eof(txtfile) do
begin
ReadLn(txtfile,tmpstr);
//从文本中取得字段数据
s := Pos(',',tmpstr);
id := copy(tmpstr,1,s-1); //
delete(tmpstr,1,s);
s := Pos(',',tmpstr);
U_ID := copy(tmpstr,1,s-1); //
delete(tmpstr,1,s);
s := Pos(',',tmpstr);
U_Name := copy(tmpstr,1,s-1); //
delete(tmpstr,1,s);
s := Pos(',',tmpstr);
Num := copy(tmpstr,1,s-1); //
delete(tmpstr,1,s);
s := Pos(',',tmpstr);
L_ID := copy(tmpstr,1,s-1); //
delete(tmpstr,1,s);
//写入数据库
with DataSet do
begin
DataSet.Append;
FieldByName(ID').AsString := id;
FieldByName('U_ID').AsString := U_ID;
FieldByName('U_Name').AsString := U_Name;
FieldByName(Num').AsString := Num;
FieldByName('L_ID').AsString := L_ID ;
Post;
end; // with
end; // while
end;
showmessage('导入数据库完毕');
end;
name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-3528650120430763&dt=1183890684015&lmt=1183890684&format=468x60_as&output=html&correlator=1183890684000&url=http%3A%2F%2Fgmai9999.googlepages.com%2Fhome&ad_type=text_image&ui=rc%3A0&cc=100&flash=9&u_h=768&u_w=1024&u_ah=738&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="468" scrolling="no" height="60" allowtransparency="allowtransparency">