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

Thanks for your help . this simple code worked:

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

        Dim strSQL3 As String

        cnn.Open()

        Dim cnn2 As New SqlClient.SqlConnection(strConnection)
        strSQL3 = "UPDATE members_bkp2 set password=@pwd where id=@id"
        Dim Cmd2 As New SqlCommand(strSQL3, cnn2)
        cnn2.Open()


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


            Cmd2 = New SqlCommand(strSQL3, cnn2)

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

            Cmd2.ExecuteNonQuery()



        End While


        dr.Close()

Reply With Quote