Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

There is already an open DataReader associated with this Connection which must be closed first. (no replies)

$
0
0
Hello All,

I am facing with an exception below:

"There is already an open DataReader associated with this Connection which must be closed first."

I am using NET Connector 6.2.2

there is no any DataReader prior this method below:

public void InsertCalls(string ccname, string tapiserver, string cdate, string ctime, int callid, int callhandle, string agentgroupname)
{
try
{
string period = this.GetPeriod(cdate);
string sql = "insert calls (ccname,tapiserver,cdate,ctime,callid,callhandle,provinfo,agentgroupname) values (@ccname,@tapiserver,@cdate,@ctime,@callid,@callhandle,@provinfo,@agentgroupname)";
MySqlConnection cn = new MySqlConnection();
cn = MySQLConnection;
if (cn.State == ConnectionState.Closed) cn.Open();
MySqlCommand cmd = new MySqlCommand(sql, cn);
cmd.Parameters.AddWithValue("@ccname", ccname);
cmd.Parameters.AddWithValue("@tapiserver", tapiserver);
cmd.Parameters.AddWithValue("@cdate", cdate);
cmd.Parameters.AddWithValue("@ctime", ctime);
cmd.Parameters.AddWithValue("@provinfo", provinfo);
cmd.Parameters.AddWithValue("@agentgroupname",
cmd.ExecuteNonQuery();
}
catch (Exception) { }
finally { }
}

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>