Click here to Skip to main content
15,894,337 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
Private Sub cbo_mytrip_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbo_mytrip.SelectedIndexChanged
     If cbo_mytrip.SelectedValue = "--select driver name--" Then
         objdbconn.OpenConn()
         msSQL = " select b.vehicle_no from tae_mst_tdriver " & _
                 "left join tae_mst_tvehicle b on a.vehicle_gid=b.vehicle_gid" & _
                  "where driver_gid='" & cbo_mytrip.SelectedValue & "'"
         objODBCDataReader = objdbconn.GetDataReader(msSQL)
         If objODBCDataReader.HasRows = True Then
             txttrip_vehiclenoedit.Text = objODBCDataReader.Item("vehicle_gid").ToString
         End If
         objODBCDataReader.Close()
         objdbconn.CloseConn()
     End If
 End Sub
Posted
Comments
KaushalJB 25-Mar-15 3:37am    
What is the issue ??
Michael_Davies 26-Mar-15 17:46pm    
Do not know your problem as you do not say...but, you need to test for nothing selected before you test SelectedValue otherwise you may get an exception: If cbo_mytrip.SelectedIndex <> -1 Then

Try .SelectedText or .SelectedItem.ToString
Manoj K Bhoir 29-Mar-15 12:21pm    
Question is not clear. Please use Improve Question and specify what exactly you are doing and where you stuck?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900