1 pièce(s) jointe(s)
[ASP.NET/VB.NET] Erreur sur une fonction
Bonjour,
J'ai un peu de mal à expliquer l'erreur donc je donne le contexte : Je fais un site web (SGBD SQL server), voici le souci qui se pose :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
Public Function searchpage(ByRef nompage As String) As Dictionary(Of Integer, String)
Dim command As New SqlCommand("select control_page from site_controls", oConnection)
Dim temp As String = ""
Dim temp2 As New Dictionary(Of Integer, String)
Dim count As Integer = 0
Try
oConnection.Close()
oConnection.Open()
Catch ex As Exception
oConnection.Close()
MsgBox (ex.Message.ToString)
End Try
Try
Do Until command.ExecuteReader(CommandBehavior.Default).Read
temp = command.ExecuteReader.GetValue(0)
temp2.Add(0, temp)
command.ExecuteReader(CommandBehavior.Default).NextResult()
MsgBox(temp.ToString, MsgBoxStyle.OkCancel, "Hoy")
Loop
command.ExecuteReader(CommandBehavior.Default).Close()
oConnection.Close()
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
Return temp2
End Function |
J'obtiens le message d'erreur suivant :
Citation:
Un datareader associé à cette commande est déjà ouvert
Je met en pj une image où vous pourrez voir la SGBD et sa structure au cas où le problème vienne de là mais j'en doute j'ai déjà check le tout 10 fois T-T :
Je ne sais pas trop quoi ajouter si ce n'est que j'ai envie de passer le PC par la fenêtre... T-T
Jennifer.