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

View Comments

1. 테이블에서 데이터 조회
      Dim intCount As Integer
            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)
                End With
                Call DB_DISCONNECT()
                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?)

Leave a Reply

0 Tracbacks (+view to the desc.)

Newer Entries Older Entries