Public Sub getconcom_name()
ledcmbsrcitem.Items.Clear()
Try
obcon.cmd.CommandText = "select con_id,f_name + ' ' + m_name + ' ' + l_name as 'name' from contact where type='company'"
obcon.con.Open()
Dim dr As SqlDataReader
dr = obcon.cmd.ExecuteReader
Dim oDataSet As New DataSet()
While (dr.Read)
' MsgBox(dr.Item(0))
ledcmbsrcitem.Items.Add(dr.Item(1))
End While
Catch ex As Exception
MsgBox(ex.Message)
Finally
obcon.con.Close()
End Try
End Sub
Public Sub getconcom_id()
Try
obcon.cmd.CommandText = "select con_id from contact where f_name + ' ' + m_name + ' ' + l_name ='" & ledcmbsrcitem.Text & "'"
obcon.con.Open()
' obcon.cmd.Connection = obcon.con
concom_id = obcon.cmd.ExecuteScalar
MsgBox(concom_id)
Catch ex As Exception
MsgBox(ex.Message)
Finally
obcon.con.Close()
End Try
End Sub
'here problem is if same name available i cant get its id,it always get first compared name's id.