G
Guest
Good day for everybody!
I new .NET developer... How I can to do this:
Dim cmdCommand1 As SqlCommand
Dim cmdCommand2 As SqlCommand
Dim dataReader1 As SqlDataReader
Dim dataReader2 As SqlDataReader
cmdCommand1 = New SqlCommand("SELECT * FROM Table1", cnnSPE)
cnn.Open()
dataReader1 = cmdCommand1.ExecuteReader
Do While dataReader1.Read
cmdCommand2 = New SqlCommand("Select * from Table2 Where Field1=" &
dataReader1("Field1"), cnn)
dataReader2 = cmdCommand2.ExecuteReader
While drCandidatos.Read
End While
dataReader1.Close()
Loop
cnn.Close()
When i execute the program show this error:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll
Additional information: There is already an open DataReader associated with
this Connection which must be closed first.
Are there other solution for that?
Thanks for your help.
I new .NET developer... How I can to do this:
Dim cmdCommand1 As SqlCommand
Dim cmdCommand2 As SqlCommand
Dim dataReader1 As SqlDataReader
Dim dataReader2 As SqlDataReader
cmdCommand1 = New SqlCommand("SELECT * FROM Table1", cnnSPE)
cnn.Open()
dataReader1 = cmdCommand1.ExecuteReader
Do While dataReader1.Read
cmdCommand2 = New SqlCommand("Select * from Table2 Where Field1=" &
dataReader1("Field1"), cnn)
dataReader2 = cmdCommand2.ExecuteReader
While drCandidatos.Read
End While
dataReader1.Close()
Loop
cnn.Close()
When i execute the program show this error:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll
Additional information: There is already an open DataReader associated with
this Connection which must be closed first.
Are there other solution for that?
Thanks for your help.