我是刚开始学习着个软件 做了一个连接数据库的程序,但是在多次访问库以后机器会死机,是不是dataset建立太多的原因 我不知道 哪个地方出问题了!不知道怎么解决请高手帮我解决以下!!

解决方案 »

  1.   

    看看你的连接又没有Close掉?
      

  2.   

    我的代码是
    this.SqlConnection1=new SqlConnection("workstation id=ZPCAT-63WX870HT;packet size=4096;user id=sa;data source=127.0.0.1;persist security info=True;initial catalog=jhlt");
    this.DataSet1=new DataSet();
    this.SqlCommand1=SqlConnection1.CreateCommand();
    SqlCommand1.CommandText="select 序号,姓名,学号,状态 from test";
    this.SqlDataAdapter1=new SqlDataAdapter(SqlCommand1);
    this.SqlDataAdapter1.Fill(DataSet1,"test");
    this.DataGrid1.DataSource=DataSet1;
    this.DataGrid1.DataMember="test";
    this.DataGrid1.DataBind();
    SqlConnection1.close