请看我的程序:
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;

解决方案 »

  1.   

    ADOCommand1.CommandType := cmdText;
    ADOCommand1.CommandText := strSql;
    res := ADOCommand1.Execute;
      

  2.   

    请问这个事怎么来的:ADOCommand1
      

  3.   

    麻烦能不能改一下我的程序,我还是搞不出来,我现在的程序:procedure TForm1.Button1Click(Sender: TObject);
    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;