Running an MS Access query from .NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Has anyone successfully used an Access query from .NET? I am trying to do
this and am getting a weird error. .NET calls queries 'stored procedures'.
The error I am getting says "Schema could not be retrieved for this stored
procedure' ... "The underlying enumerator did not support enumerating objects
of type 'ProcedureParamater'". .Net does recognize the stored procedure i.e.
it does appear in the drop-sdown list.
 
Hello,

Access does not support stored procedures. What query are you firing against
Access?

Best regards,
Henning Krause
 
Thanks for the response.
I'm not actually doing the .Net part, that is another guy but I've been
looking over his shoulder. He is binding a data grid to the data and is using
a 'wizard' (for want of a better term) in Visual Studio. He can specify
either 'tables and views' (which drop-down does NOT list the query) or
'custom stored procedures' which does list the query. As soon as he selects
the query from the drop-down, he gets the error I mentioned. When we cut and
paste the entire text of the query into .NET to run, it runs fine, but I'd
prefer him to be executing the query.
Here is the query:
SELECT FirstName, LastName, Address1, Address2, City, State, ZipCode,
RecordType, HowMany, RecordDate FROM tblAddressOnline
UNION SELECT FirstName, LastName, Address1, Address2, City, State, ZipCode,
RecordType, HowMany, RecordDate FROM tblAddress
ORDER BY LastName, FirstName;

-Dorian
 
¤ Thanks for the response.
¤ I'm not actually doing the .Net part, that is another guy but I've been
¤ looking over his shoulder. He is binding a data grid to the data and is using
¤ a 'wizard' (for want of a better term) in Visual Studio. He can specify
¤ either 'tables and views' (which drop-down does NOT list the query) or
¤ 'custom stored procedures' which does list the query. As soon as he selects
¤ the query from the drop-down, he gets the error I mentioned. When we cut and
¤ paste the entire text of the query into .NET to run, it runs fine, but I'd
¤ prefer him to be executing the query.
¤ Here is the query:
¤ SELECT FirstName, LastName, Address1, Address2, City, State, ZipCode,
¤ RecordType, HowMany, RecordDate FROM tblAddressOnline
¤ UNION SELECT FirstName, LastName, Address1, Address2, City, State, ZipCode,
¤ RecordType, HowMany, RecordDate FROM tblAddress
¤ ORDER BY LastName, FirstName;
¤

The Designer is not very reliable when it comes to running/testing Jet database engine queries.
However, in most instances you can save the data source and it will run fine during application
execution.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top