Need help perfoming actions on the result of a query

theCrave's Avatar, Join Date: Feb 2009
Newbie Member
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
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
What database are you using?
0
expvice's Avatar, Join Date: Mar 2009
Newbie Member
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 shabbir; 4Mar2009 at 14:10.. Reason: Link snipped