如题

解决方案 »

  1.   

    参考
    http://singlepine.cnblogs.com/articles/281425.html
      

  2.   

    DataGrid可以绑定DataSet,DataTable,
    数据库操作层返回DataSet就好了,数据操作的时候可以通过存储过程。
      

  3.   

    你可以写执行存储过程返回DataSet的方法,然后再绑定到Grid中去
      

  4.   

    原理我也理解, 如何实现SqlConnection myConnection = new SqlConnection( ConfigurationSettings.AppSettings["ConnectionString"]);
    SqlCommand myCommand= new SqlCommand("Get_Member_Net",myConnection);
    myCommand.CommandType=CommandType.StoredProcedure; SqlParameter ParameterOrder=new SqlParameter("@会员编号",SqlDbType.NChar,4);
    ParameterOrder.Value=UserNo;
    myCommand.Parameters.Add(ParameterOrder);
    myConnection.Open();
                                ///////////////////////////////////////////////////  // ?????? ExecResult=myCommand.ExecuteNonQuery()(不可以);

    //if (ExecResult==1)
    //{
           //SqlDataAdapter adpt01 = new SqlDataAdapter();
        SqlDataReader DR01=myCommand.ExecuteReader ();
        //adpt01.SelectCommand= myCommand;     DataSet DS01= new DataSet();
                                   // ??????? DataSet ds = SqlHelper.ExecuteDataSet(ConfigurationSettings.AppSettings "ConnectionString"],CommandType.StoreProcedure,"Get_Member_Net");
        
                                   ///////////////////////////////////////////////////////
                                   Grid1.DataSource=DS01; 
        Grid1.DataBind(); 多谢了!
      

  5.   

    如果是查询存储过程这些不需要,因为这是进行插入,删除,更新记录用的
    // ?????? ExecResult=myCommand.ExecuteNonQuery()(不可以);

    //if (ExecResult==1)
    //{
      

  6.   

    把datagrid数据源设置成执行存储过程的函数就可以了
    Class1 aa=new Class1();
    DataGrid1.DataSource =aa.Emp_Sel(this.TextBox1.Text,Int32.Parse(this.TextBox2.Text));
    DataGrid1.DataBind();
    Class1是我写的一个类,在里面执行存储过程
      

  7.   

    mumu1980() ,您好:
      父类中如何返回记录集, 请赐教
      

  8.   

    Emp_Sel(this.TextBox1.Text,Int32.Parse(this.TextBox2.Text)应该是您写的一个函数,返回为记录集...
      

  9.   

    通过   SqlDataReader DR01=myCommand.ExecuteReader (); 如何实现Grid绑定呢?