[VB.Net] PostgreSQL 데이터 조회하기

View Comments

1. 테이블에서 데이터 조회
      Dim intCount As Integer
 
        Try
            If DB_CONNECT() Then
                strCmd.Connection = gOleDBConn
                strCmd.CommandType = CommandType.Text
                strCmd.CommandText = "SELECT * FROM code"
 
                objDA.SelectCommand = strCmd
                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
 
                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)
 
            Call DB_DISCONNECT()
        End Try

댓글0 Comments (+add yours?)

트랙백0 Tracbacks (+view to the desc.)

Newer Entries Older Entries