How to keep a table that contains select query results
Hi
I have 2 select queries that are ret开发者_如何学Gourned to two seperate tables. While i am processing one of them inside a function i need the other query result to be kept inside a global parameter. How do i save the query result so it wont be overwritten when the function works? ThanksIf I've understood you right, you need to store it in a variable outside of the scope of the 'Execute Query' method?
To do that declare a DataTable variable (or whatever you're using to store the result) outside of the method and simply set it to the query result when you execute the query. Something like this:
public class MyClass
{
private DataTable _mySavedQueryResult = null;
private void ExecuteMyQuery()
{
// Execute the query
_mySavedQueryResult = ... // result of copy of the result query
}
}
You can then use _mySavedQueryResult to access the result of the query after you have exited ExecuteMyQuery
.
精彩评论