Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Already an open DataReader?
Message
De
15/01/2013 14:33:23
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Already an open DataReader?
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01562745
Message ID:
01562745
Vues:
45
I'm getting a 'Already as open DataReader of that name' error on the following code:
    Using sconn As New SqlConnection(ConnString)
      Try
        PswrdTries = PswrdTries + 1
        If PswrdTries > 2 Then
          Me.Close()
        End If
        sconn.Open()
        Dim msql1 As String = "Select * from CATDecode where DecName = 'PASSWORD'"
        Using ms1 As New SqlCommand(msql1, sconn)
          Using ds1 = ms1.ExecuteReader
            If ds1.Read Then
              If Trim(ds1.Item("DecValue").ToString.ToUpper) <> Trim(txtPassWord.Text.ToUpper) Then
                MsgBox("Password does not match" & vbCrLf & "One try left", vbOKOnly + vbCritical, "Incorrect Password")
              Else
                Dim msql2 As String = "Select * from CATDecode where DecName = 'SUBBANK'"
                Using ms2 As New SqlCommand(msql2, sconn)
** Error occurs on next statement **
                  Using ds2 = ms2.ExecuteReader
                    If ds2.Read() Then
                      TestSub = ds2.Item("DecValue").ToString.Substring(4, ds2.Item("DecValue").ToString.Length)
                    End If
                  End Using
                End Using
              End If
            End If
          End Using
        End Using
        sconn.Close()
      Catch ex As Exception
        sconn.Close()
        MsgBox("Sql Exception:  " & ex.Message)
      End Try
    End Using
What am I missing?
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform