创建参数一定不要使用它的向导,只会产生一堆垃圾。看一看帮助文档,建议使用sqlcommond的parameters的add方法创建参数

解决方案 »

  1.   

    直接在程序中配置Adapter,然后Fill一个new DataSet/DataTable好啦
      

  2.   

    其实,你可以自己写DataSet的啊,如果你的存储过程在sql里运行正常的话,那么在.net下自己写吧!
    给你个例子:
    1.建立一个连接串test(在webconfig文件里,aaa是存放你存储过程的机子)
    <add key="test" value="server=aaa;database=test;uid=sa;pwd=" />
    2.创建一个类(比如叫:p_staff.cs)
    public DataSet staff(string xueli)  
    { SqlDataAdapter MyAdapter= new SqlDataAdapter();
    SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["test"]);
    MyAdapter.SelectCommand  = new SqlCommand("p_staff", myConnection);
    MyAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
    SqlParameter parameterxueli = new SqlParameter("@xueli", SqlDbType.VarChar, 6);
    parameterxueli.Value =xueli;
    MyAdapter.SelectCommand.Parameters.Add(parameterxueli);
    // Open the database connection and execute the command
    DataSet ds=new DataSet();
    myConnection.Open();
    try
    {
    MyAdapter.Fill(ds);
    return ds;
    }
    finally
    {
    myConnection.Close();
    }
    }//end
    3.在.net里,建你需要的控件,这里建一个TextBox,一个Button(叫Btn_check),一个DataGrid(叫DataGrid1
    private void Btn_check_Click(object sender, System.EventArgs e)
    {
    DataGrid1.CurrentPageIndex=0;
    LOVECsharp.p_staff myErp=new LOVECsharp.p_staff();
    DataGrid1.DataSource =myErp.staff(TextBox1.Text);
    DataGrid1.DataBind();
    }
    namespace为LOVECsharp,aspx文件为:p_staff.aspx你试一下,应该可以搞定的!呵呵
      

  3.   

    用存储过程就不用dataset了,直接传参数就可以了。