473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ht use MS Access like a stored procedure?

I cannot figure out how to:

1. call an Access query from C# and consume the recordset, where the query
uses a user defined function. for example

select rowid, GetBreedOfCat([rowid]) from tblCats;

2. call an Access function from C# and consume the returned value. For
example, how to consume the returned recordset:
Public function getAllcats() as recordset
end function
Thank you for your help,

John
Jul 21 '05 #1
2 1390
In the same way as with any other COM component: you must use automation and
COM Interoperability to achieve things like that by opening an Access
application object and making your call from this object.

An Access database is split into two entity: the Database part, with the JET
driver and the VBA/GUI part. When you open an access database with the JET
ADO.NET driver, you don't have access to the VBA/GUI part. If you want to
have access to a VBA functionf, you must first open the Acces application as
a COM object and ask it to make the required call to the JET driver on your
behalf.

Obviously, unless you already know your way in and out of Access automation,
this is probably not worth the energy to try it.

S. L.

"Rigid Kitten" <mr********@comcast.net> wrote in message
news:z4********************@comcast.com...
I cannot figure out how to:

1. call an Access query from C# and consume the recordset, where the
query
uses a user defined function. for example

select rowid, GetBreedOfCat([rowid]) from tblCats;

2. call an Access function from C# and consume the returned value. For
example, how to consume the returned recordset:
Public function getAllcats() as recordset
end function
Thank you for your help,

John

Jul 21 '05 #2
On Mon, 21 Feb 2005 07:58:41 -0700, "Rigid Kitten" <mr********@comcast.net> wrote:

¤ I cannot figure out how to:
¤
¤ 1. call an Access query from C# and consume the recordset, where the query
¤ uses a user defined function. for example
¤
¤ select rowid, GetBreedOfCat([rowid]) from tblCats;
¤

User defined (VBA) functions are not supported through Jet OLEDB or ODBC. They're only supported
when running under Access. Only the sandbox functions are supported:

http://support.microsoft.com/default...b;en-us;294698

¤
¤
¤ 2. call an Access function from C# and consume the returned value. For
¤ example, how to consume the returned recordset:
¤ Public function getAllcats() as recordset
¤ end function

This isn't supported unless you use Access automation as Sylvain pointed out.
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: 8leggeddj | last post by:
Hello, I am having a problem when using access xp as a frontend for sql server 2000. I have been trying to update a number of stored procedures (Just simple adding fields etc) which results in...
0
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
2
by: Josh Strickland | last post by:
I am attempting to create an Access database which uses forms to enter data. The issue I am having is returning the query results from the Stored Procedure back in to the Access Form. ...
1
by: Lauren Quantrell | last post by:
I have read the newsgroups and see this is a common issue but I saw no resolution for it: I have an Access2K frotn end and SQL Server 2K backend. In access, I create a temp table using code in a...
8
by: lauren quantrell | last post by:
When I open an Access form I can have no recordset specified, then in the form's OnOpen event I can do something like: Me.paramaters = "@SomeColumn = 22)" Me.recordsource = "dbo.sproc123" But I...
15
by: brettclare | last post by:
I have linked a large SQL Server table to Access, however 'only' 2,195,439 records are shown and are available to query. Can I increase the size (cache??)/number of records showing in Access? ...
0
by: totierne | last post by:
comp.databases.ms-access, I want to know how to use Oracle views with session variables in Access. The parameterised views in access, are migrated to views with per session variables. The...
6
by: Peter Neumaier | last post by:
Hi, I am trying to select some data through a stored procedure and would like to store the result in a local access table. Is that possible? Can somebody provide an example? Thanks&regards!...
2
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges...
23
by: Gloops | last post by:
Hello everybody, Is anyone able to give me some indications about how to develop an Access interface for an Oracle database ? I dispose of Access 2003 (11.6566.8107) SP2, Oracle 9i 9.2.0.1.0...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.