So i am trying to recreate a VB6 program into VB.net, but am having trouble understanding DataBinding.
I have the following windows form:
-See image in next post.
So when this form loads, I need to fill the combo box with values to choose from. The combobox has several columns. Here is my code so far:
This is where I am stuck. The combobox should contain s.esec_empl_id,s.esec_user_id, and EMPLOYEE from the above sql. Then when someone selects someone from the list, it should populate the fields and add check marks to the appropriate boxes. These values are stored in the other parts of the sql above. What do I do next. I am stuck here. After changes are made, I need to update, delete etc the record.
Any help that you could provide would be very much appreciated.
I have the following windows form:
-See image in next post.
So when this form loads, I need to fill the combo box with values to choose from. The combobox has several columns. Here is my code so far:
VB.NET:
Private Sub LoadEmps()
If mstroracle = "ORAP" Then
oracletype = My.Settings.ORAP_Conn
ElseIf mstroracle = "ORAT" Then
oracletype = My.Settings.ORAT_Conn
End If
'Build ConnectionString based on user login details
Dim odbcbuilder As New OdbcConnectionStringBuilder(oracletype)
odbcbuilder.Add("UID", mstruser)
odbcbuilder.Add("PWD", oldpassword)
'Attempt to connect to Oracle Database
oracle_conn2.ConnectionString = odbcbuilder.ConnectionString
oracle_conn2.Open()
Dim strTSQL As String
strTSQL = "SELECT s.esec_empl_id,s.esec_user_id,s.esec_empl_type,s.esec_lastlog_dt,s.esec_priv_01," & vbCrLf
strTSQL = strTSQL & " s.esec_priv_02,s.esec_priv_03,s.esec_priv_04,s.esec_priv_05,s.esec_priv_06," & vbCrLf
strTSQL = strTSQL & " s.esec_priv_07,s.esec_priv_08,s.esec_priv_09,s.esec_priv_10,s.esec_priv_11," & vbCrLf
strTSQL = strTSQL & " s.esec_priv_12,s.esec_priv_13,s.esec_priv_14,s.esec_priv_15,s.esec_priv_16," & vbCrLf
strTSQL = strTSQL & " CASE " & vbCrLf
strTSQL = strTSQL & " WHEN e.empl_last_name IS NULL " & vbCrLf
strTSQL = strTSQL & " THEN '' " & vbCrLf
strTSQL = strTSQL & " ELSE e.empl_last_name||', '||e.empl_first_name|| " & vbCrLf
strTSQL = strTSQL & " CASE " & vbCrLf
strTSQL = strTSQL & " WHEN e.empl_middle_init = ' ' " & vbCrLf
strTSQL = strTSQL & " THEN '' " & vbCrLf
strTSQL = strTSQL & " ELSE ' '||e.empl_middle_init||'.' " & vbCrLf
strTSQL = strTSQL & " END " & vbCrLf
strTSQL = strTSQL & " END EMPLOYEE " & vbCrLf
strTSQL = strTSQL & "FROM fset.tfsetesec s LEFT JOIN fset.tfsetempl e ON s.esec_empl_id=TRIM(e.empl_id) " & vbCrLf
strTSQL = strTSQL & "ORDER BY 2 ASC "
oracle_da = New Odbc.OdbcDataAdapter(strTSQL, oracle_conn2)
oracle_da.Fill(oracle_ds, "Security")
End Sub
This is where I am stuck. The combobox should contain s.esec_empl_id,s.esec_user_id, and EMPLOYEE from the above sql. Then when someone selects someone from the list, it should populate the fields and add check marks to the appropriate boxes. These values are stored in the other parts of the sql above. What do I do next. I am stuck here. After changes are made, I need to update, delete etc the record.
Any help that you could provide would be very much appreciated.