i create one function but in return function so there is error like argument not specified for parameter 'arguments' of public function give some proper soluation and code for checking same value in database and if value are same then msg box show value are exists and new value then insert data
Public Function UserExit(ByVal empcode As Boolean) As Boolean
Dim cmd As New SqlCommand("select * from EmMaster where EmploHba_EmpCode =@ec ")
cmd.Parameters.AddWithValue("@ec", txtEmpCode.Text.Trim())
cmd.CommandType = CommandType.Text
cmd.Connection = cn
cn.Open()
Dim dr As New SqlDataReader
dr = cmd.ExecuteReader()
If (dr.HasRows) Then
Return True
Else
Return False
cn.Close()
End If
End Function
Private Sub txtEmpCode_LostFocus(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles txtEmpCode.LostFocus
UserExit()
UserExit.this.userexit()
If(UserExit == False) then
Else
MessageBox.Show("EXIXTS DATA")
End If