Error:There is already an open DataReader associated with this command

hi

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
[2035 byte] By [getnitha] at [2007-11-20 9:18:38]
# 1 Re: Error:There is already an open DataReader associated with this command
Welcome to the Forum :wave:

DataReaders are connected in nature and whenever you open a datareader the connection kept busy with that reader unless you close it. You cannot run any other operation on this connection unless you close the datareader. The better option is to use a DataSet.

Also when you post code, make sure you are using CODE tags like this
your code here
Shuja Ali at 2007-11-10 3:30:02 >
# 2 Re: Error:There is already an open DataReader associated with this command
Thanx for ur information

I am new to .net so can plse tell me how to implement dataset in my code
getnitha at 2007-11-10 3:30:56 >
# 3 Re: Error:There is already an open DataReader associated with this command
Thanx for ur information

I am new to .net so can plse tell me how to implement dataset in my code
Here are some of the links that will help you
http://www.dnzone.com/ShowDetail.asp?NewsId=594
http://msdn2.microsoft.com/en-us/library/system.data.dataset.aspx

You need to open a dataset using a DataAdapter.
Shuja Ali at 2007-11-10 3:32:05 >