function TForm1.ComputerLocalIP: string; function TForm1.WinUserName: string; function TForm1.computernameA: string; 使用如上函数可以正常获取本地计算机IP、主机名、登录用户名,如何把获取的信息insert into数据为表A中?
楼上的正确,这样也可以
try
with ADOquery do
begin
close;
sql.Clear;
sql.Add('insert into A(本地计算机IP,主机名,登录用户名) values(:aa,:bb,:cc)');
parameters.ParamByName('aa').Value:=本地计算机IP;
parameters.ParamByName('bb').Value:=主机名;
parameters.ParamByName('cc').Value:=登录用户名;
execsql;
end;
except
showmessage('插入信息错误');
end;
adoquery1.close;
adoquery1.sql.text:='insert into tablename(f1,f2,f3)values('''+ComputerLocalIP+''','''+WinUserName+''','''+computernameA+''')'
adoquery1.execsql;