I
Ian
I have been having a number of problems trying to do
some joined queries (i.e. involving more than one table
in an SQL statement) in ADO.NET/VB.NET, using an Access XP
database running through the OleDb classes.
As an example, the following code falls over on the second
of the two fill statements (i.e. the last but one line.)
Dim cn As OleDbConnection, com1 As OleDbCommand = Nothing,
com2 As OleDbCommand = Nothing
Dim ad1, ad2 As OleDbDataAdapter, ds As DataSet
Dim sSQL1 As String, sSQL2 As String
sSQL1 = "SELECT collection_supplier_item_iKey_model,
collection_supplier_item_iKey_fabric,
collection_supplier_item_iKey_size FROM INPUT_ARTICLES"
sSQL2 = "SELECT model, fabric, size FROM INPUT_PRICES"
ds = New DataSet()
cn = New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=DataRepository.mdb")
com1 = New OleDbCommand(sSQL1, cn)
ad1 = New OleDbDataAdapter()
ad1.SelectCommand = com1
ad1.TableMappings.Add("Table", "INPUT_ARTICLES")
com2 = New OleDbCommand(sSQL2, cn)
ad2 = New OleDbDataAdapter()
ad2.SelectCommand = com2
ad2.TableMappings.Add("Table", "INPUT_PRICES")
cn.Open()
ad1.Fill(ds)
ad2.Fill(ds)
cn.Close()
The error message that results is :
Unhandled Exception: System.Data.OleDb.OleDbException:
Unspecified error: E_FAIL(0x80004005)
I.e it doesnt actually give any clue as to what the
problem is. Having played around with this problem for a
while, including using a data reader to try to access
these two tables by means of a single joined SQL
statement, and each time running across the same error
message, which doesnt actually say what the problem is, I
am quite mystified. Any ideas what may be causing this?
Thanks
Ian
some joined queries (i.e. involving more than one table
in an SQL statement) in ADO.NET/VB.NET, using an Access XP
database running through the OleDb classes.
As an example, the following code falls over on the second
of the two fill statements (i.e. the last but one line.)
Dim cn As OleDbConnection, com1 As OleDbCommand = Nothing,
com2 As OleDbCommand = Nothing
Dim ad1, ad2 As OleDbDataAdapter, ds As DataSet
Dim sSQL1 As String, sSQL2 As String
sSQL1 = "SELECT collection_supplier_item_iKey_model,
collection_supplier_item_iKey_fabric,
collection_supplier_item_iKey_size FROM INPUT_ARTICLES"
sSQL2 = "SELECT model, fabric, size FROM INPUT_PRICES"
ds = New DataSet()
cn = New OleDbConnection
("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=DataRepository.mdb")
com1 = New OleDbCommand(sSQL1, cn)
ad1 = New OleDbDataAdapter()
ad1.SelectCommand = com1
ad1.TableMappings.Add("Table", "INPUT_ARTICLES")
com2 = New OleDbCommand(sSQL2, cn)
ad2 = New OleDbDataAdapter()
ad2.SelectCommand = com2
ad2.TableMappings.Add("Table", "INPUT_PRICES")
cn.Open()
ad1.Fill(ds)
ad2.Fill(ds)
cn.Close()
The error message that results is :
Unhandled Exception: System.Data.OleDb.OleDbException:
Unspecified error: E_FAIL(0x80004005)
I.e it doesnt actually give any clue as to what the
problem is. Having played around with this problem for a
while, including using a data reader to try to access
these two tables by means of a single joined SQL
statement, and each time running across the same error
message, which doesnt actually say what the problem is, I
am quite mystified. Any ideas what may be causing this?
Thanks
Ian