In my C# application all queries runs well both with MS Access and SQL Server
databses. But only the following query runs well on SLQ Server2000 but with
MS Access gives error
=> "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)."
QUERY:
" SELECT "+
" (select Quantity from Items_Detail idt "+
" where idt.Barcode = MB.Barcode "+
" AND MB.inv_date='Friday, September 16, 2005'" +
" ) AS \"Qty on: Friday, September 16, 2005\"" +
" ,(select Quantity from Items_Detail idt "+
" where idt.Barcode = MB.Barcode "+
" AND MB.inv_date='Tuesday, September 20, 2005'"+
" ) AS \"Qty on: Tuesday, September 20, 2005\""+
" , idt.Barcode, idt.Place, idt.Description, idt.[Purchase Date],
idt.[Years Used], idt.[Condition], idt.[Actual], idt.[Elevative],
idt.[Depreciation], idt.[Notebook Value], idt.Present, idt.Absent,
idt.[Absence Reason] " +
" FROM Items_Detail idt, "+
" ( /*The purpose of this query is to return the missing Barcodes in either
of two Dates*/ "+
" SELECT Inv_Date, Barcode FROM Inventory inv "+
" WHERE "+
" inv.Barcode IN (select inventory.Barcode from inventory where
inv_date='Friday, September 16, 2005')"+
" AND inv.Barcode NOT IN (select inventory.Barcode from inventory where
inv_date='Tuesday, September 20, 2005')"+
" OR "+
" inv.Barcode IN (select inventory.Barcode from inventory where
inv_date='Tuesday, September 20, 2005')"+
" AND inv.Barcode NOT IN (select inventory.Barcode from inventory where
inv_date='Friday, September 16, 2005')"+
" ) MB /*Missed Barcodes*/ "+
" WHERE idt.Barcode = MB.Barcode "+
" AND (MB.Inv_Date = 'Friday, September 16, 2005' OR MB.Inv_Date = 'Tuesday,
September 20, 2005') ";
The connection strings I am using are as follows:
Connection Srting for SLQ Server:
cn_str = "Provider=SQLOLEDB.1;Server=arif_nb\\cArabic; Database=BassamDb;
User ID=sa; Pwd=; Integrated Security=false;";
Connection Srting for MS Access:
cn_str = @"Provider=Microsoft.Jet.OleDb.4.0;Data Source=" +
Settings.database + ";jet oledb:Database Password=" + Settings.pwd;
This is somehow a complex query and I don't know that MS Access supports
this type of queries. In SQL Server it is working well.
Please help in identiying that why this quey gives Error =>
"IErrorInfo.GetDescription failed with E_FAIL(0x80004005)." with MS Access
database, while works well with SQL Server.
Arif.