1. 테이블에서 데이터 조회
Dim intCount As Integer
Try
If DB_CONNECT() Then
strCmd.Connection = gOleDBConn
strCmd.CommandType = CommandType.Text
strCmd.CommandText = "SELECT * FROM code"
If DB_CONNECT() Then
strCmd.Connection = gOleDBConn
strCmd.CommandType = CommandType.Text
strCmd.CommandText = "SELECT * FROM code"
objDA.SelectCommand = strCmd
objDA.Fill(objDS, "code")
objDA.Fill(objDS, "code")
With objDS.Tables("code")
For intCount = 0 To .Rows.Count - 1
cbRelate.Items.Add(.Rows(intCount).Item("c_code").ToString & " : " & .Rows(intCount).Item("c_value").ToString)
Next
End With
For intCount = 0 To .Rows.Count - 1
cbRelate.Items.Add(.Rows(intCount).Item("c_code").ToString & " : " & .Rows(intCount).Item("c_value").ToString)
Next
End With
Call DB_DISCONNECT()
Else
MessageBox.Show("DB 연결을 확인하십시오!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
MessageBox.Show("DB 연결을 확인하십시오!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)
Call DB_DISCONNECT()
End Try
End Try