View Single Post
  #10 (permalink)  
Old January 23rd, 2007, 01:18 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 use the following code with a new command but i get this error:
There is already an open DataReader associated with this Command which must be closed first.

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

        Dim strSQL3 As String

        cnn.Open()

        strSQL3 = "UPDATE members_bkp set password=@pwd"
        Dim Cmd2 As New SqlCommand(strSQL3, cnn)
        dr = Cmd.ExecuteReader()
        While dr.Read()
            Dim strPWEncoded As String = FormsAuthentication.HashPasswordForStoringInConfig File(dr("password"), "SHA1")

            Cmd2 = New SqlCommand(strSQL3, cnn)

            Cmd2.Parameters.Add(New SqlParameter("@pwd", strPWEncoded))

            Cmd2.ExecuteNonQuery()
        End While

Reply With Quote