Running an Access97 Query From VS.NET C# Windows App

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

A few days ago I posted a question where I asked about how I could call/run
a query in an Access97 db from a Wndows Application I am writing with VS.Net
2003 in C#.



I had a couple of replies and good suggestions but none fully helped me get
the thing in gear because I guess I am too inexperienced in this area to
fully understand how to implement their suggestions.



Then I found an article entitled 'How to automate Microsoft Access by using
Visual C#' at



http://www.dotnet247.com/247reference/a.aspx?u=http://support.microsoft.com/?kbid=317114



which helped me accomplish my task with some minor code modification (I
changed the 'Print_Report()' function to execute the query I need to run
using oAccess.DoCmd.OpenQuery(.). It does work but I am wondering about one
of the responses I got a few days ago where someone suggested I try



currentdb.execute "NameOfYourQuery"



Does anyone know how to use this code.could you provide a sample? I ask
because the code I am using from the link above is pretty long and probably
does a lot of stuff that creates quite a bit of overhead.



Thanks in advance
 
CurrentDb.Execute "NameOfYourQuery" will only work for Action queries
(Insert Into, Update, Delete). It will do nothing for Select queries.
 
are you trying to consume access vba - specific custom functions????

what's the text of your query; you might need access automation.
 
We make a distinction between 'running' a query and
'displaying' a query. To display data in C# you might
use a form. To make changes to data in a database you
might use ADO.net.
currentdb.execute "NameOfYourQuery"


Well, you aren't the only person here who is not experienced.
That is how you would make changes to data if you were using
Microsoft Office Pro instead of C#.

(david)
 
Back
Top