Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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

Discussion in 'Information Technology' started by Frank, Jul 28, 2006.

  1. Frank

    Frank
    Expand Collapse
    Guest

    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
     
  2. Loading...


  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    CurrentDb.Execute "NameOfYourQuery" will only work for Action queries
    (Insert Into, Update, Delete). It will do nothing for Select queries.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Frank" <fkaesser@pfmail.com> wrote in message
    news:eNXMr5yiGHA.1640@TK2MSFTNGP02.phx.gbl...
    > 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
    >
    >
     
  4. david epsom dot com dot au

    david epsom dot com dot au
    Expand Collapse
    Guest

    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)

    "Frank" <fkaesser@pfmail.com> wrote in message
    news:eNXMr5yiGHA.1640@TK2MSFTNGP02.phx.gbl...
    >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
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page