메뉴 건너뛰기

app

[evb] ADOCE, 유용한 제어1

박영식2006.09.01 19:23조회 수 1575댓글 0

    • 글자 크기
TABLE을 생성하는 함수를 만들어 봤다.

TEXT상자 이름은 tbName이고, Label의 이름은 checkL이다.
tbName을 잘 읽는지 시험하려고 만는 Label은 그렇게 큰 의미는 없다.

Me.tbName.Text를 Create Table 할 때, 이름으로 지정하면 된다.

Private Function OpenDbFortable() As Boolean
        
    On Error Resume Next

    ' 에러가 발생하면 쉽게 종료하기 위해 에러 조건
    ' 에 대한 리턴 값을 설정한다.
    OpenDbFortable = False
    
     checkL.Caption = Me.tbName.Text
    If Me.tbName.Text = "" Then 'if문을 이용해 쿼리가 error나지 않을 최소조건(공백체크)을 설정 한다.
        '에러메세지
        MsgBox "txt상자에 글자가 없습니다."
        Exit Function
    Else

        If gobjConnection.State = adStateClosed Then
            ' 포켓 액세스 데이터베이스 오픈
           gobjConnection.Open CD_CDB_PATH_FILENAME
        End If
        ' text상자에 쓴 이름으로 테이블 생성
           gobjConnection.Execute "CREATE TABLE '" & Me.tbName.Text & "'" _
                    & "(NoId int, PoName varchar(64), PoTarget varchar(64), PoState varchar(100), PoProgress int, PoSideEffect varchar(100), PoExpire varchar(64), PoReference varchar(100), PoPrepro varchar(100), PoIcon varchar(64), PoLateDay int)"
    
    End If
    
    If Err.Number = 0 Then
        OpenDbFortable = True
    End If

End Function


--------------------쿼리만 바꾼 table 지우는 함수 ------------------
Private Function CloseDbFortable() As Boolean  '''''''''''''테이블을 지우는 함수입니다. !!!
        
    On Error Resume Next

    ' 에러가 발생하면 쉽게 종료하기 위해 에러 조건
    ' 에 대한 리턴 값을 설정한다.
    CloseDbFortable = False
    
     checkL.Caption = Me.tbName.Text
    If Me.tbName.Text = "" Then 'if문을 이용해 쿼리가 error나지 않을 최소조건(공백체크)을 설정 한다.
        '에러메세지
        MsgBox "txt상자에 글자가 없습니다."
        Exit Function
    Else

        If gobjConnection.State = adStateClosed Then
            ' 포켓 액세스 데이터베이스 오픈
           gobjConnection.Open CD_CDB_PATH_FILENAME
        End If
        ' text상자에 쓴 이름으로 테이블 제거
           gobjConnection.Execute "drop TABLE '" & Me.tbName.Text & "'"
    
    End If
    
    If Err.Number = 0 Then
        CloseDbFortable = True
    End If

End Function
박영식 (비회원)
    • 글자 크기
[evb] CD관리 프로그램에 버그 찾기 (by 박영식) [evb] CD 관리기 using ADOCE 3.0 (by 박영식)

댓글 달기

박영식
2007.07.08 조회 2358
박영식
2007.06.14 조회 2633
박영식
2007.04.04 조회 5643
박영식
2007.02.16 조회 2443
박영식
2007.02.15 조회 2638
박영식
2006.09.19 조회 1927
박영식
2006.09.14 조회 1973
박영식
2006.09.09 조회 1903
박영식
2006.09.05 조회 1963
박영식
2006.09.01 조회 1575
첨부 (0)
위로