게임강의

[VB.Net] PostgreSQL 데이터 입력하기

컨텐츠 정보

본문


1. 신규 데이터 입력하기



        Dim intCount As Integer



 



        Try

            If DB_CONNECT() Then

                strCmd.Connection = gOleDBConn

                strCmd.CommandType = CommandType.Text

                strCmd.CommandText = "INSERT INTO person VALUES('" & cbRelate.Text.Substring(0, 2) & "', '" & txtName.Text & "', '" & txtBirthday.Text & "', '" & txtHomeAddr.Text & "', '" & txtHomeTel.Text & "', '" & txtComName.Text & "', '" & txtComAddr.Text & "', '" & txtComTel.Text & "', '" & txtCellPhone.Text & "', '" & txtMemo.Text & "')"



 



                objDA.InsertCommand = strCmd

                intCount = objDA.InsertCommand.ExecuteNonQuery()



 



                If intCount = -1 Then

                    MessageBox.Show("데이터 입력 성공", "SUCCESS", MessageBoxButtons.OK, MessageBoxIcon.Information)

                Else

                    MessageBox.Show("데이터 입력 실패!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error)

                End If



 



                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



 



출처 : http://parkgunstyle.kr/6


관련자료

댓글 0
등록된 댓글이 없습니다.

최근글


새댓글


  • 등록자 벼배릅 등록일 04.14
알림 0