请看我的程序:
procedure TForm1.Button1Click(Sender: TObject);
var
conn:_connection;
res:_Recordset;
strSql:string;
begin
StrConn:='Provider=SQLOLEDB.1;Password="";Persist Security Info=True;'
+'User ID=sa;Initial Catalog=pubs;Data Source=huangq';
conn.ConnectionString:=StrConn;
strSql:='select * from employee';
res := conn.Execute(strSql,1);//这个地方我不知道怎么写,,给一个解决方法
while not res.EOF do
begin
showMessage(res.Fields.Item[0].Value);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
conn:_connection;
res:_Recordset;
strSql:string;
begin
StrConn:='Provider=SQLOLEDB.1;Password="";Persist Security Info=True;'
+'User ID=sa;Initial Catalog=pubs;Data Source=huangq';
conn.ConnectionString:=StrConn;
strSql:='select * from employee';
res := conn.Execute(strSql,1);//这个地方我不知道怎么写,,给一个解决方法
while not res.EOF do
begin
showMessage(res.Fields.Item[0].Value);
end;
end;
ADOCommand1.CommandText := strSql;
res := ADOCommand1.Execute;
var
conn:_connection;
res:_Recordset;
strSql:string;
command1:_Command;
begin
StrConn:='Provider=SQLOLEDB.1;Password="";Persist Security Info=True;'
+'User ID=sa;Initial Catalog=pubs;Data Source=huangq';
conn.ConnectionString:=StrConn;
strSql:='select * from employee'; command1.CommandType :=cmdText
command1.CommandText :=strSql; res := command1.Execute;//此处报错,且少参数
// res := conn.Execute(strSql,cmdText,1);//(strSql,,0) ;
while not res.EOF do
begin
showMessage(res.Fields.Item[0].Value);
end;
end;