Friday, June 22, 2012

Exception : IErrorInfo.GetDescription failed with E_FAIL(0x80004005)


Issue :
Once I was try to fetch record from access database in which I have facing minor error message like :

IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

Code Snippet :
Private Sub GetItems(ByVal strSearch As String)
      Try
         Dim objDAL As New DataAccessLayer

         str = "SELECT code,ProductDesc from ProductMaster where isDeleted = 0"
         str = str & " ORDER by ProductDesc"

         dtTemp = New DataTable()
         dtTemp = objDAL.GetDataTable(str, DataAccessLayer.QueryType.SelectQuery)

         If dtTemp.Rows.Count > 0 Then
           dlProductList.DataSource = dtTemp
           dlProductList.DataBind()
      Else
           lblMag.Visible = True
           lblMag.Text = "No Records Available yet."
      End If
      Catch ex As Exception
      Finally
    End Try
End Sub


Solution :

Some database field may be reserved word in several DBMS. You just replace below line in upper code :

  str = "SELECT [code],[ProductDesc ] from ProductMaster where isDeleted = 0"

you can just try with bracket like [] around the database field.

I hope that it will help you and solve your problem!

No comments:

Post a Comment

If you have any doubts, please let me know

PARASHURAMA JAYANTI 2020

In year 2020, Parashurama Jayanti will Celebrate on Saturday, 25th April 2020. Parashurama Jayanti Muhurat : Parashurama J...