DataAdapter建 连接
然后用DataGrid 
显示 出来!

解决方案 »

  1.   

    这个和winform是一样的,只要把服务器资源管理器的数据库托过来就可以了
      

  2.   

    DataSet ds;
                ds=null;
    if (refresh==true||Session["COLLIGATE_MONTH1"]==null)
    {
    string sql;
    if (this.TextBox1.Text=="" )
    {
    sql="select top 600 * from COLLIGATE_MONTH1  ";
    }
    else
    {
    sql="select * from COLLIGATE_MONTH1 where telnum='"+this.TextBox1.Text+"'";//+" order by db_time desc";
    }

    this.sqlConnection1.Open();//.sqlConnection1.Open(); SqlDataAdapter mycommand =new SqlDataAdapter(sql ,this.sqlConnection1);
    ds=new DataSet();
    mycommand.Fill(ds,"COLLIGATE_MONTH1");
    Session["COLLIGATE_MONTH1"]=ds;
    this.sqlConnection1.Close();
      

  3.   

    string strCon = "Provider = SQLOLEDB.1 ; Persist Security Info = False ; User ID = sa ; Initial Catalog = data1 ; Data Source = server1 " ;
    OleDbConnection myConn = new OleDbConnection ( strCon ) ;
    myConn.Open ( ) ;
      

  4.   

    http://www.csdn.net/Develop/read_article.asp?id=16437
      

  5.   

    运行后,DATAGIRD根本没有显示啊!
      

  6.   

    DATAGRID.DataSouce = ds.tables[0].defaultView;
      

  7.   

    我也被烦了一天了。在winform里,我自己加上一个函数可以让dataGrid有数据显示,但是在webform里就死活不认了。痛苦。
    ////////////////////////////////////我的方法是:
    1.加一个类方法
    private void init()
    {
    this.sqlDataAdapter1.Fill(this.dataSet11,"Employees");

    }
    2.在form1的构造函数中加上:
    init();   //加在InitializeComponent();的后面
    //
    //这个方法我在winform中是实现了的。