jjzjj

objDataReader

全部标签

c# - 错误 'there is already an open datareader associated with this command which must be closed first'

运行时错误“已经有一个与此命令关联的打开的数据读取器必须先关闭”objCommand=newSqlCommand("SELECTfield1,field2FROMsourcetable",objConn);objDataReader=objCommand.ExecuteReader();while(objDataReader.Read()){objInsertCommand=newSqlCommand("INSERTINTOtablename(field1,field2)VALUES(3,'"+objDataReader[0]+"')",objConn);objInsertComman

c# - 错误 'there is already an open datareader associated with this command which must be closed first'

运行时错误“已经有一个与此命令关联的打开的数据读取器必须先关闭”objCommand=newSqlCommand("SELECTfield1,field2FROMsourcetable",objConn);objDataReader=objCommand.ExecuteReader();while(objDataReader.Read()){objInsertCommand=newSqlCommand("INSERTINTOtablename(field1,field2)VALUES(3,'"+objDataReader[0]+"')",objConn);objInsertComman