hi there,
Question 1:
i have a question in invalid operation exception. it says that " there is already an open datareader associate with this command which must be closed first. "
the code is shown below
public void AddToAction()
{
String query = @"Select * from TopicAction";
SqlCommand command = new SqlCommand(query,DB.getConnection());
db.openConnection();
SqlDataReader reader = command.ExecuteReader();
SqlDataAdapter da = new SqlDataAdapter(command);
DataTable dt = new DataTable();
[B] da.Fill(dt);
[/B]
while (reader.Read())
{
for (int r = 0; r < dt.Columns.Count; r++)
{
for (int c = 0; c < dt.Columns.Count; c++ )
dgvDAction.Rows[r].Cells[c].Value = dt.Rows[r]["TActionID"].ToString();
}
}
reader.Close();
db.closeConnection();
}
the bolded text in the code is highlighted and the aboveexception occurs. how can i solve this.
Question 2:
when getting data from the MS SQL MDF file what are the connections that i should close??
please reply
thanxxxxxxxxxxx