VB中的传参:
set rs=Execute("exec AddUser '" & User "','" & Pwd "'")
请问如何在ASP.net中使用上面的那句,也就是存储过程名称+参数直接传
哪位好心帮助我,万分感激!

解决方案 »

  1.   

    http://pingzi.blogbus.com/logs/2005/12/1665160.html
      

  2.   

    command = new SqlCommand("AddUser",cn);      
    command.CommandType = CommandType.StoredProcedure;
    command.Parameters.Add("@Name", SqlDbType.VarChar, 255);
    command.Parameters.Add("@Password", SqlDbType.VarChar, 255);
    command.Parameters["@Name"].Value = User ;
    command.Parameters["@Password"].Value = pwd ;
    SqlDataReader dr = command.ExecuteReader();
      

  3.   

    using System.Data;
    using System.Data.SqlClient;SqlConnection con = new SqlConnection(connectString);
    command = new SqlCommand("AddUser",cn);
    command.CommandType = CommandType.StoredProcedure;
    command.Parameters.Add("@Name", SqlDbType.VarChar, 255);
    command.Parameters.Add("@Password", SqlDbType.VarChar, 255);
    command.Parameters["@Name"].Value = User ;
    command.Parameters["@Password"].Value = pwd ;
    SqlDataReader dr = command.ExecuteReader();
      

  4.   

    //我用过的示例代码
    public DataSet GetFlightInfo(string beginsite, string endsite)
    {
    this.cn = new SqlConnection("server = localhost; uid = sa; pwd = sa; database = FlightInfo");
    this.cn.Open();

    System.Data.DataSet ds = new System.Data.DataSet();
    System.Data.SqlClient.SqlDataAdapter da = new SqlDataAdapter("EXECUTE GetFlightInfo " + beginsite + "," + endsite,this.cn);
    da.Fill(ds,"GetFlightInfo"); this.cn.Close(); return ds;
    }
      

  5.   

    太感谢“amandag(高歌)”了,我要的就是那段代码~~~~
    谢了哦!
      

  6.   

    using System.Data;
    using System.Data.SqlClient;SqlConnection con = new SqlConnection(connectString);
    command = new SqlCommand("AddUser",cn);
    command.CommandType = CommandType.StoredProcedure;
    command.Parameters.Add("@Name", SqlDbType.VarChar, 255);
    command.Parameters.Add("@Password", SqlDbType.VarChar, 255);
    command.Parameters["@Name"].Value = User ;
    command.Parameters["@Password"].Value = pwd ;
    SqlDataReader dr = command.ExecuteReader();