hi, now i'm doing change password form but i try a lot of sample already but still can't work , who can show me the example.

this is my code can u check for me thank you!!!





Imports System.Data.SqlClient

Public Class Form2
Inherits System.Windows.Forms.Form

Dim cn As New SqlConnection
Dim da As New SqlDataAdapter
Dim cm As New SqlCommand
Dim ds As New DataSet
Dim dsEmp As New DataSet
Dim cmEmp As New SqlCommand
Dim SQLstr As String
Dim RowNo As Integer = 0

Dim i As Integer
Dim cm1 As CurrencyManager
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

cn.ConnectionString = "data source=(local);integrated security=SSPI;initial catalog=videosystem;"
cn.Open()


cmEmp.Connection = cn
cmEmp.CommandText = "select * from Employees"

da.SelectCommand = cmEmp
da.Fill(dsEmp, "Employees")

cm.Connection = cn
ds.Clear()

SQLstr = "select * from Employees where UserName ='" & str & "'"
cm.CommandText = SQLstr
da.SelectCommand = cm
da.Fill(ds, "Pass")

cm1 = Me.BindingContext(ds, "Pass")


RefreshData()

Dim i As Integer

da.Fill(ds, "Employees")
da.SelectCommand.CommandText = "select * from Employees where UserName= '" & TextBox1.Text & "'"


da.UpdateCommand = New Data.SqlClient.SqlCommand




End Sub
Sub RefreshData()


TextBox1.Text = ds.Tables("Pass").Rows(cm1.Position)(0)
TextBox2.Text = ds.Tables("Pass").Rows(cm1.Position)(1)
TextBox2.Focus()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


da.UpdateCommand.Connection = cn
da.UpdateCommand.CommandText = "update Employees set Password = '" & TextBox2.Text & "'"

Try
da.UpdateCommand.ExecuteNonQuery()
ds.Clear()
da.Fill(ds, "Employees")

Catch Ex As Exception
End Try
cn.Close()
Me.Close()

End Class