SOURABH DEY

SOURABH DEY

  • NA
  • 27
  • 11k

IErrorInfo.GetDescription(0x80004005)

Mar 11 2010 12:15 PM
Here's an code enclosed with an error IErrorInfo.GetDescription(0x80004005).Plz rply.

public static bool RemoveBook(string BookTitle, int Quantity, string AuthorName, string CategoryName)
        {
            bool IsSuccess = false;
            try
            {
                OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\SOURABH DEY\\My Documents\\Visual Studio 2008\\Projects\\Library Management System\\Library Management System\\Library.mdb;");
                conn.Open();
                OleDbCommand cmd = new OleDbCommand("", conn);
                String OleDbCommand = "BEGIN TRANSACTION\r\n";
                // rows are not removed from system but inventory status is set as false and such records
                // are not at all considered in system for issue etc.
                for (int i = 0; i < Quantity; i++)
                {
                    OleDbCommand += "update [Lib_Book_Details] set [Lib_Book_In_Inventory] = 0 where [Lib_Book_ID] = ";
                    OleDbCommand += "(select top 1 Lib_Book_ID from [Lib_Book_Details] [a] join [Lib_Book_Categories] [b] on [b].[Category_ID] = [a].[Lib_Book_Category] where [a].[Lib_Book_Title] = '" + BookTitle + "' and [a].[Lib_book_issue_status] = 0 and [a].[Lib_Book_In_Inventory] = 1 ";
                    OleDbCommand += "and [a].[Lib_Book_Author_Name]= '" + AuthorName + "' and [b].[Category_Name] = '" + CategoryName + "')\r\n";
                }
                OleDbCommand += "Commit Transaction";
                cmd.CommandText = OleDbCommand;
                int Count = cmd.ExecuteNonQuery();
                if (Count >= 1)
                {
                    IsSuccess = true;
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return IsSuccess;

        }