hii frnd i need your help i am work on vb.net window application my qus is
IN COMBO BOX I SET THE VALUE FORM THE DATABASE AND IT'S SHOW IN COMBO BOX LIKE NAME BUT NOW IF I SELECT NAME THEN OTHER INFOMATION LIKE EMAIL ID OR ETC ARE ALSO SHOW THE VALUE ..means i select one name and other infomation show .only i select combobox name ...
Public Function select_employee_details(ByVal empcode As String) As DataTable
Dim cmd As New SqlClient.SqlCommand
Dim tbl As New DataTable
Dim da As New SqlClient.SqlDataAdapter
'Dim reader As SqlClient.SqlDataReader
Dim ds As New DataSet
Dim sql_select As String
Try
cn.Open()
sql_select = "select * from EmMaster where EmMaster_EmpCode ='" + empcode + "'"
'sql_select = "select * from EmMaster"
'cmd = New SqlClient.SqlCommand(sql_select, cn)
'reader = cmd.ExecuteReader
' da.Fill(ds, "EmMaster")
da = New SqlDataAdapter(sql_select, cn)
da.Fill(ds, "EmMaster")
tbl = ds.Tables(0)
cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Return tbl
End Function
Private Sub HbaDetails_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Dim cn As New SqlConnection("Data Source=HAARD-PARIKH\SQLEXPRESS;Initial Catalog=databasehba;Integrated Security=True")
Dim strSQL As String = "select EmMaster_EmployId,EmMaster_EmpCode,EmMaster_EmpName from EmMaster"
Dim da As New System.Data.SqlClient.SqlDataAdapter(strSQL, cn)
Dim ds As New DataSet
da.Fill(ds, "EmMaster")
With Me.cmbName
' .ItemsSource
.ItemsSource = ds.Tables(0).DefaultView
.DisplayMemberPath = "EmMaster_EmpName"
.SelectedValuePath = "EmMaster_EmployId"
.SelectedIndex = 0
End With
End Sub