thanks for prompt reply, i was ready to add another message so i could give a better picture of what i am doing.
I have windows application that has a main form and few other forms to perform some admin tasks. The Main form displays data from Open Jobs. User can update job quantity by click on buttons. But some data is refreshed on this main form after every 30 seconds using timer.
I have create a global data adapter that i am using to create my entities and my entity collections with in refreshData module. while the main form is open i am opening another form to filter jobs. This form has Component One's Flex grid. I use stored procedure to get data using my global adapter. I am not closing or re-initializing data adapter, adapter is created when user logs in to this application once. I then make modifications to grid and save this data for each line using stored procedure. This is where i get this error "There is already an open DataReader Associated with this connection". This happens only some times.
TimerFunctionMain Form () {
Creates few Entity Collections to get data grids.
Entity object to get some data for fields
Some stored procedure calls
}
FilterClick() {
//on admin form while Main Form is still open
System.Data.DataTable dt = RetrievalProcedures.Sp_PIPFilterJobs(sSelect, sWhere, sSort, SystemSettings.da);
DataColumn cAccumSAMS = new DataColumn("SAMSAccum",System.Type.GetType("System.Decimal"));
DataColumn cAvailSAMS = new DataColumn("AvailableSAMS",System.Type.GetType("System.Decimal"));
dt.Columns.Add(cAccumSAMS);
dt.Columns.Add(cAvailSAMS);
this.dgJobs.DataSource = dt;
}
//SAVE GRID Generates error some times only.
private void cmdSave_Click(object sender, System.EventArgs e)
{
for (int i=1; i < dgJobs.Rows.Count; i++) {
C1.Win.C1FlexGrid.Row dr = dgJobs.Rows[i];
try {
string sMsg = "UPDATE PIP_JOBS SET PriorityID = " + dr["PriorityID"].ToString() + ", CutlistSeq = " + dr["CutlistSeq"] + ""; //, SewDate" +
sMsg = sMsg + " WHERE JobID = " + dr["JobID"].ToString();
PIPData.DatabaseSpecific.ActionProcedures.Sp_PIPExecuteSQL(sMsg, SystemSettings.da);
}
catch (Exception exp) {
MessageBox.Show(exp.Message.ToString());
}
}
}