jep2002
February 20th, 2006, 02:29 AM
Hie..i have this problem that i do not understand. Below are my codes. The problem is whenever i set the data retrieved from database to the controls. Only some of the combo box display the data. What i do not understand is IF i change the combo box drop down style from "drop down list" to "drop down" it worked! . I dont want the user to tamper with the data displayed in the combo box. Plz help. TQ
Dim conn As New OracleConnection(refDB)
Try
conn.Open()
Dim cmd As New OracleCommand
Dim retValue As String
cmd.Connection = conn
cmd.CommandText = "select * from ME_PIPE_INDEX where ME_NUMBER = '" & Trim(txtMEno.Text.ToUpper) & "'"
cmd.CommandType = CommandType.Text
Dim dr As OracleDataReader = cmd.ExecuteReader()
If dr.Read() Then
retValue = Trim(dr("ME_NUMBER"))
If retValue = txtMEno.Text.ToUpper Then
cboType.Text = (dr("ME_NUM3_DESC"))
cboLMC.Text = (dr("ME_NUM4_DESC"))
txtRemCode.Text = (dr("ME_NUM5678"))
cboDescMaterial.Text = (dr("MAT_DESC"))
cboConst.Text = (dr("CONST_DESC"))
cboDescSch.Text = (dr("SCHEDULE_DESC"))
cboDescEndPrep.Text = (dr("END_PREP_DESC"))
lblMaterialCode.Text = (dr("ME_NUMBER"))
lblDesc.Text = (dr("DESCRIPTION"))
txtID.Text = (dr("ME_PIPE_ID"))
btnDelete.Enabled = True
Else
MsgBox(" ME Number Doesn't Exist ", vbCritical, "Error Searching")
End If
Else
MsgBox(" Job Doesn't Exist ", vbCritical, "Error Searching")
End If
Catch ex As OracleException ' catches only Oracle errors
Select Case ex.Number
Case 1
MessageBox.Show("Error attempting to insert duplicate data.")
Case 12545
MessageBox.Show("The database is unavailable.")
Case Else
MessageBox.Show("Database error: " + ex.Message.ToString())
End Select
Catch ex As Exception ' catches any error
MessageBox.Show(ex.Message.ToString())
Finally
conn.Dispose()
End Try
Dim conn As New OracleConnection(refDB)
Try
conn.Open()
Dim cmd As New OracleCommand
Dim retValue As String
cmd.Connection = conn
cmd.CommandText = "select * from ME_PIPE_INDEX where ME_NUMBER = '" & Trim(txtMEno.Text.ToUpper) & "'"
cmd.CommandType = CommandType.Text
Dim dr As OracleDataReader = cmd.ExecuteReader()
If dr.Read() Then
retValue = Trim(dr("ME_NUMBER"))
If retValue = txtMEno.Text.ToUpper Then
cboType.Text = (dr("ME_NUM3_DESC"))
cboLMC.Text = (dr("ME_NUM4_DESC"))
txtRemCode.Text = (dr("ME_NUM5678"))
cboDescMaterial.Text = (dr("MAT_DESC"))
cboConst.Text = (dr("CONST_DESC"))
cboDescSch.Text = (dr("SCHEDULE_DESC"))
cboDescEndPrep.Text = (dr("END_PREP_DESC"))
lblMaterialCode.Text = (dr("ME_NUMBER"))
lblDesc.Text = (dr("DESCRIPTION"))
txtID.Text = (dr("ME_PIPE_ID"))
btnDelete.Enabled = True
Else
MsgBox(" ME Number Doesn't Exist ", vbCritical, "Error Searching")
End If
Else
MsgBox(" Job Doesn't Exist ", vbCritical, "Error Searching")
End If
Catch ex As OracleException ' catches only Oracle errors
Select Case ex.Number
Case 1
MessageBox.Show("Error attempting to insert duplicate data.")
Case 12545
MessageBox.Show("The database is unavailable.")
Case Else
MessageBox.Show("Database error: " + ex.Message.ToString())
End Select
Catch ex As Exception ' catches any error
MessageBox.Show(ex.Message.ToString())
Finally
conn.Dispose()
End Try