View Single Post
  #8 (permalink)  
Old January 23rd, 2007, 12:44 PM
keyvanjan keyvanjan is offline
Friend of Wrox
 
Join Date: May 2005
Location: , , .
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I get error "there is already an open datareader"
on line :Cmd.ExecuteNonQuery()


 Dim strPW As String = ""
        Dim dr As SqlDataReader

        Dim cnn As New SqlClient.SqlConnection(strConnection)
        Dim sql As String = "Select password from members_bkp"
        Dim Cmd As New SqlCommand(Sql, cnn)




        cnn.Open()

        dr = Cmd.ExecuteReader()
        While dr.Read()
            Dim strPWEncoded As String = FormsAuthentication.HashPasswordForStoringInConfig File(dr("password"), "SHA1")

            Dim strSQL3 As String
            strSQL3 = "UPDATE members_bkp set password=@pwd"
            Cmd = New SqlCommand(strSQL3, cnn)
            Cmd.Parameters.Add(New SqlParameter("@pwd", strPWEncoded))
            Cmd.ExecuteNonQuery()
        End While



Reply With Quote