: System.InvalidOperationException: 已有打开的与此连接相关联的 DataReader,必须首先将它关闭。
string sql1 = "insert into get_movie values('"+name+"','"+this.TextBox1.Text+"','"+DateTime.Now.ToString()+"','"+url+"','"+0+"','"+des+"')";
string sql2 = "select counts from hardinfo where serianlo = '"+name+"'";
cmd = new SqlCommand(sql,sqlConn);
cmd1 = new SqlCommand(sql1,sqlConn);
cmd2 = new SqlCommand(sql2,sqlConn);
SqlDataReader read = null;
SqlDataReader read2 = null;
sqlConn.Open();
read = cmd.ExecuteReader();
read2 = cmd2.ExecuteReader();
while(read.Read() && read2.Read())
{
int count = Convert.ToInt32(Convert.ToString(read.GetValue(0)));
int hard_info_count = Convert.ToInt32(read2.GetValue(0));
string names = Convert.ToString(read.GetValue(1));
if(count>hard_info_count)
{
Response.Write("<script>alert('请求失败,一周之内只能请求'"+hard_info_count+"'部影片!')</script>");
p =true;
return;
}
if(names == this.TextBox1.Text)
{
Response.Write("<script>alert('您已请求过此影片,请不要重复求片!')</script>");
p =true;
return;
}
}
sqlConn.Close();
if(p == false)
{
sqlConn.Open();
cmd1.ExecuteNonQuery();
sqlConn.Close();
Response.Write("<script>alert('影片信息已发出请等候!')</script>");
}
--------------
行 73: sqlConn.Open();
行 74: read = cmd.ExecuteReader();
行 75: read2 = cmd2.ExecuteReader();
行 76: while(read.Read() && read2.Read())
行 77: {
相关推荐
win10启动docker报错System.InvalidOperationException-附件资源
win10启动docker报错System.InvalidOperationException-附件资源
System.InvalidOperationException(解决方案).md
System.InvalidOperationException(解决方案).md
InvalidOperationException解决的例子
C# InvalidOperationException<br>跨界面线程时常遇到这个错误,需要用委托来安全的处理线程才是正道
在Windows 10系统上,运行Docker服务时遇到System.InvalidOperationException,并附带相关资源
资源下载链接为: https://pan.quark.cn/s/5e942b5354ca 【源码免费下载链接】: 在Windows 10环境下使用Docker时出现错误:$System.InvalidOperationException$
异常类型及版本,抛出IndexOutOfRangeException类型异常,抛出InvalidOperationException类型异常,抛出InvalidOperationException类型异常,抛出InvalidOperationException类型异
异常类型及版本,抛出IndexOutOfRangeException类型异常,抛出InvalidOperationException类型异常,抛出InvalidOperationException类型异常,抛出InvalidOperationException类型异 常,C#源代码


