I have a method in C# which should get some data from mysql and then insert this data in another table.
The problem is that no matter what I try i get another datareader is open
.
I tried using the using
statement, but with no success, maybe I do it wrong.
How to do that?
public void MethodName(List<string> objects)
{
foreach(string Object in objects){
SQLActions.Initialize();
SQLActions.SQL_Open();
MySqlDataReader queryData = SQLActions.SQL_Query("SELECT...query...");
MySqlDataReader objectsData = SQLActions.SQL_Query("Another select....");
SQLActions.SQL_NonQuery("Insert...");
while(queryData.Read()){
SQLActions.SQL_NonQuery("Another Insert...");
}
SQLActions.SQL_Close();
}
}