B
Bnob
Here is my code :
'G_myConnection is a global SqlConnection
' the table VACDES , AGENDA are in the same Database
..
..
Monsql = "SELECT * FROM VACDES WHERE NUM=" & G_Num & " ORDER BY
NUM_MOIS"
cmd1 = New SqlCommand(Monsql, G_myConnection)
dr1 = cmd1.ExecuteReader
While dr1.Read
Monsql = "select SEM from AGENDA where DATE1=" & lDate
cmd2 = New SqlCommand(Monsql, G_myConnection)
dr2 = cmd2.ExecuteReader
While dr2.Read
dim toto as string = dr1.Item("myField")
.... my code
End While
drJoursFerieWeek.Close()
end while
dr1.close
..
..
..
But I have this error message when I excute "dr2 = cmd2.ExecuteReader"
:"There is already an open DataReader associated with this Connection
which must be closed first."
Any idea to do two SqlDataReader in same time ?
'G_myConnection is a global SqlConnection
' the table VACDES , AGENDA are in the same Database
..
..
Monsql = "SELECT * FROM VACDES WHERE NUM=" & G_Num & " ORDER BY
NUM_MOIS"
cmd1 = New SqlCommand(Monsql, G_myConnection)
dr1 = cmd1.ExecuteReader
While dr1.Read
Monsql = "select SEM from AGENDA where DATE1=" & lDate
cmd2 = New SqlCommand(Monsql, G_myConnection)
dr2 = cmd2.ExecuteReader
While dr2.Read
dim toto as string = dr1.Item("myField")
.... my code
End While
drJoursFerieWeek.Close()
end while
dr1.close
..
..
..
But I have this error message when I excute "dr2 = cmd2.ExecuteReader"
:"There is already an open DataReader associated with this Connection
which must be closed first."
Any idea to do two SqlDataReader in same time ?