Need help perfoming actions on the result of a query

Discussion in 'C#' started by theCrave, Feb 16, 2009.

  1. theCrave

    theCrave New Member

    Joined:
    Feb 16, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I am building an application that will keep track of items. Users will be allowed to insert data into an access database, and they will also be able to edit and return query results from this database.

    Currently I have brought in the oledb class, set up forms to enter information into the database. Using oledbcommand and execute.nonquery I am able to enter the input into the database with no problem. I am also able to write a query and display it in my datagridview.

    My problem is this. I need to query my db using user input, and then use these results to do further actions. For example I would like to do something along these lines:

    SELECT TOP "variable" field1, field2, field3
    FROM table1
    WHERE field3="A"

    Up to here I'm fine, I can write this and make it work. But, now I want to be able to use the results returned from above and do something like:

    INSERT INTO table1(field4) VALUES ('S');
    &
    SELECT field1, field2, SUM(field3) AS SumOfField3
    FROM table1
    GROUP BY field2, field1 --> Again I want to use the results from the first query, and I also want to make SUM(field3)'s value available to the user.

    Thanks for any help
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    What database are you using?
     
  3. expvice

    expvice New Member

    Joined:
    Mar 4, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Your questions is complex, and also we need detail information about your question so we are online at that link, just reach us to get answer
    <<Snipped>>
     
    Last edited by a moderator: Mar 4, 2009

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice