0

私は、mysql をバックエンドおよび Web サーバーで使用する Windows ベースの VB.NET アプリケーションを開発しています。Web サービス (asmx) を使用してデータベースに接続していますが、すべての操作は完全に機能しています。一部の SELECT クエリでは結果が生成されず (エラーも発生しません)、同じクエリでは 1 時間後または翌日に結果が生成されることがあります。この動作のため、エラーのヒントを見つけることができず、プロジェクトを続行できません。

何が起こっているのかを教えていただければ、事前に感謝します

コードは以下です

<SoapHeader("Authentication")> _
<WebMethod(Description:="Get the result from sql query - Returns a Dataset")> _
Public Function ExecuteQuery(ByVal strQuery As String) As DataSet

    Dim ds As DataSet = New DataSet 'create a DataSet to hold the results
    If decryptString(Authentication.Username) = "bla bla" AndAlso decryptString(Authentication.Password) = "bla blah" Then

        Try

            'create a MySqlCommand to represent the query
            If sqlConn.State = ConnectionState.Closed Then
                sqlConn = New MySqlConnection(conStr)
                sqlConn.Open()
            End If

            Dim sqlcmd As MySqlCommand = sqlConn.CreateCommand()
            sqlcmd.CommandType = CommandType.Text
            sqlcmd.CommandText = strQuery

            'create a MySqlDataAdapter object
            Dim sqlDa As MySqlDataAdapter = New MySqlDataAdapter
            sqlDa.SelectCommand = sqlcmd

            Try
                'fill the DataSet using the DataAdapter
                sqlDa.Fill(ds, "Results")
            Catch ex As Exception
                Throw New ApplicationException("Error-luckie's server 1 " & ex.Message)
            End Try

        Catch ex As Exception
            Throw New ApplicationException("Error-luckie's server 2 " & ex.Message)
        Finally
            sqlConn.Close()
            sqlConn.Dispose()
        End Try

    End If
    Return ds

End Function
4

0 に答える 0