后台数据库是informix,在程序运行有时是正常的,有时可能因为纠错功能较弱,导致数据查询失败,这种情况出现后有时可回退重查询条件,有时会出现无法连接数据库了,客户如何做都没用了,只有重启服务器的IIS才能浏览网站,这是为什么?我原来猜测是否应未在finally语句中加myconn.close()语句,但加了还是一样的,还有是否要加myconn=nothing这一句?

解决方案 »

  1.   

    myconn=nothing 是需要的,但是也可能是其他的原因。
      

  2.   

    高手们,问题应如何去找,而且错误去找时它又查询正常,正是晕呀!
    datareader用得比较多!
      

  3.   

    datareader没colse()也不行的,它会一直连着数据库
      

  4.   

    datareader和connection全部close了
    下面这个子程序是下拉列表绑定在一个数据表上,会不会导致以上现象?Sub yyq_bind()
            Dim conn_yyq As New OleDbConnection()
            Dim adpt_yyq As New OleDbDataAdapter()
            Dim ds_yyq As New DataSet()
            Try
                conn_yyq.ConnectionString = "Provider=Ifxoledbc.2;Persist Security Info=False;User ID=dzgl;Data Source=life@onnblife_tcp;Extended Properties='';password=dzgl"
                adpt_yyq.SelectCommand = New OleDbCommand()
                adpt_yyq.SelectCommand().CommandText = "select qid,name from yyq order by qid,name"
                ds_yyq.Clear()
                adpt_yyq.SelectCommand.Connection = conn_yyq
                adpt_yyq.Fill(ds_yyq)
                DropDownList3.DataSource = ds_yyq
                DropDownList3.DataTextField = "name"
                DropDownList3.DataValueField = "qid"
                DropDownList3.DataBind()
            Catch e As Exception
                Response.Redirect("error.htm")
            Finally
                conn_yyq.Close()
            End Try
        End Sub