Alexandrumbm
Programmer
Hello again,
I have this code an it's working perfect for loading data from my database but...
I have some labels... and i want to populating them when i select an combobox item... with data from the selected row.
How can i do this ?!
---------------
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\..\..\data\fedt.mdb;Jet OLEDB
atabase Password=***************")
Dim cmd As OleDb.OleDbCommand
Dim sql = "SELECT nume, cnp, act_identitate FROM nomenclator_clienti_pf"
Dim objRead As Object
conn.Open()
cmd = New OleDb.OleDbCommand(sql, conn)
objRead = cmd.ExecuteReader()
While objRead.read()
Me.cmb_cumparator_pf.Items.Add(objRead("nume"))
End While
objRead.close()
Me.lbl_cnp_cumparator.Text = Me.cmb_cumparator_pf.SelectedItem
Me.cmb_cumparator_pf.Text = FixNull(cmd.ExecuteScalar)
If conn.State <> ConnectionState.Closed Then
conn.Close()
End If
Me.cmb_cumparator_pf.Text = ""
Me.cmb_cumparator_pf.Focus()
End If
-------------------------
i want to display in the labels the data from the selected row from database..
when i select a name from combobox to show me some info into the labels, info that is stored in the database too.
Sorry for my bad english and thanks in advice!
I have this code an it's working perfect for loading data from my database but...
I have some labels... and i want to populating them when i select an combobox item... with data from the selected row.
How can i do this ?!
---------------
Dim conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\..\..\data\fedt.mdb;Jet OLEDB
Dim cmd As OleDb.OleDbCommand
Dim sql = "SELECT nume, cnp, act_identitate FROM nomenclator_clienti_pf"
Dim objRead As Object
conn.Open()
cmd = New OleDb.OleDbCommand(sql, conn)
objRead = cmd.ExecuteReader()
While objRead.read()
Me.cmb_cumparator_pf.Items.Add(objRead("nume"))
End While
objRead.close()
Me.lbl_cnp_cumparator.Text = Me.cmb_cumparator_pf.SelectedItem
Me.cmb_cumparator_pf.Text = FixNull(cmd.ExecuteScalar)
If conn.State <> ConnectionState.Closed Then
conn.Close()
End If
Me.cmb_cumparator_pf.Text = ""
Me.cmb_cumparator_pf.Focus()
End If
-------------------------
i want to display in the labels the data from the selected row from database..
when i select a name from combobox to show me some info into the labels, info that is stored in the database too.
Sorry for my bad english and thanks in advice!