Error:There is already an open DataReader associated with this command
I am trying to read data from a table using Select query(selected columns only) and inserting these data into another table.For this i am using datareader.but its always showing me error like my title(There is already an open DataReader associated with command which should be closed first)
sample code
Dim netcmd As New SqlCommand
Dim incmd As New SqlCommand
Dim netdr As SqlDataReader
Try
conn.ConnectionString = connString
conn.Open()
sql = "select * from ATTENDENCE_REPORT"
netcmd = New SqlCommand(sql, conn)
netdr = netcmd.ExecuteReader()
While (netdr.Read())
TextBox4.Text = dr.GetString(0)
TextBox5.Text = dr.GetString(1)
TextBox6.Text = dr.GetDateTime(2)
TextBox7.Text = dr.GetString(3)
TextBox8.Text = dr.GetString(4)
TextBox9.Text = dr.GetString(5)
TextBox10.Text = dr.GetString(6)
sql1 = "insert into Temp_Attendence(User_ID,User_Name,Punch_Date,Time_In,Break_Out,Break_In,Time_Out,Delay_Time,Over_Time,Actual_Hour,Total_Late_Hours,Total_Time) values ('" + netdr.GetString(0) + "','" + netdr.GetString(1) + "','" + netdr.GetDateTime(2) + "','" + netdr.GetString(3) + "','" + netdr.GetString(4) + "','" + netdr.GetString(5) + "','" + netdr.GetString(6) + "','" + "" + "','" + "" + "','" + "" + "','" + "" + "','" + "" + " ')"
incmd = New SqlCommand(sql1, conn)
incmd.ExecuteNonQuery()
End While
netdr.Close()
incmd.Dispose()
MsgBox("inserted data")
Catch ex As Exception
MsgBox(ex.ToString())
End Try
please help me its urgent

