Background Image
조회 수 26927 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

적용 환경

Microsoft Visual Studio 6.0

ODBC 설정하기

다음의 FAQ를 참조한다.

http://www.cubrid.com/zbxe/57833

샘플코드

샘플코드 작성

아래와 같이 샘플 코드를 작성한다.

아래 코드는 OLEDB를 이용한 소스이며 ODBC를 이용하기 위해서는 OLE DB 드라이버 연결 부분을 주석처리하고 ODBC 드라이버 연결 부분의 주석을 삭제한다.

Private Sub Command1_Click()

 

    Dim Conn As New ADODB.Connection

    Dim cmd As New ADODB.Command

    Dim rs As New ADODB.Recordset

    Dim strConn As String

   

    'ODBC드라이버 연결

    'strConn = strConn & "driver={CUBRID Driver};"

    'strConn = strConn & "server=localhost;"

    'strConn = strConn & "port=33000;"

    'strConn = strConn & "uid=dba;"

    'strConn = strConn & "pwd=;"

    'strConn = strConn & "db_name=demodb;"

 

    'OLE DB 드라이버 연결

    strConn = strConn & "Provider = CUBRIDProvider;"

    strConn = strConn & "Data Source = demodb;"

    strConn = strConn & "Location = localhost;"

    strConn = strConn & "User ID = dba;"

    strConn = strConn & "Password =;"

    strConn = strConn & "Port = 33000;"

    strConn = strConn & "Fetch Size = 100;"

    strConn = strConn & "Persist Security Info = True;"

 

    Set Conn = New ADODB.Connection

    With Conn

      .ConnectionString = strConn

      .Open

    End With

 

    With cmd

        .ActiveConnection = Conn

        .CommandText = "SELECT * FROM code;"

        .CommandType = adCmdText

    End With

 

    With rs

        .Open cmd

    End With

   

    List1.Clear

    If Not rs.EOF Then rs.MoveFirst

    Do While Not rs.EOF

        List1.AddItem rs.Fields(0) & ", " & rs.Fields(1)

        rs.MoveNext

    Loop

  

    Conn.Close

   

    Set Conn = Nothing

    Set cmd = Nothing

    Set rs = Nothing

End Sub

컨트롤 추가

Form에 아래 그림과 같이 CommandButton ListBox를 추가한다.

1.PNG

컴파일 오류가 발생시 해결 방법

아래와 같은 에러가 발생하면 메뉴 > 프로젝트 > 참조 > Microsoft ActiveX Data Objects 2.0 Library를 추가한다.

2.PNG

3.PNG

샘플 코드 실행 결과

 4.PNG

 


  1. 데이터베이스 생성하기

    Date2011.03.07 Category기타 By남재우 Views29106
    Read More
  2. 복제 따라하기

    Date2008.11.21 CategoryLinux Byadmin Views29096
    Read More
  3. QuantumDB Eclipse Plugin을 사용하여 CUBRID연동하기

    Date2009.10.06 CategoryJava Bycubebridge Views28922
    Read More
  4. [질의튜닝]order by desc가 인덱스 타게 하려면

    Date2011.07.14 Category튜닝 Byadmin Views28483
    Read More
  5. CUBRID DB와 Broker 분리방안

    Date2010.04.28 CategoryLinux By정만영 Views28412
    Read More
  6. 스칼라 서브쿼리 사용 가이드

    Date2009.12.31 Category기타 By웁쓰 Views28275
    Read More
  7. 조인 방법(Join Method) 설명

    Date2009.12.31 Category기타 By웁쓰 Views27995
    Read More
  8. CUBRID2008R2.0 Windows BACKUP 자동화 설정하기

    Date2009.08.17 CategoryWindows By정만영 Views27942
    Read More
  9. CUBRID R2.0 ISV(Independent Software Vendor)설치방법

    Date2009.11.20 CategoryInstall Bycubebridge Views27922
    Read More
  10. CUBRID Tutorial (Unix/Linux)

    Date2009.08.17 CategoryLinux By정만영 Views27887
    Read More
  11. JavaSP SampleCode(Pivot기능)

    Date2009.07.28 CategoryJava Bycubebridge Views27554
    Read More
  12. 윈도우즈 환경에서 배치화일을 이용하여 백업 또는 데이터베이스 정리 수행하기

    Date2010.03.03 CategoryWindows By남재우 Views27487
    Read More
  13. CUBRID JDBC에서 유니코드 사용하기

    Date2009.08.15 CategoryJava By손승일 Views27435
    Read More
  14. CUBRID2008 R2.1 업그레이드시 serial 관련 문제 해결 방법

    Date2010.01.28 CategoryInstall By남재우 Views27348
    Read More
  15. CUBRID2008 R2.0 Tutorial (Windows)

    Date2009.08.17 CategoryWindows Bycubebridge Views27340
    Read More
  16. eclipse에서 python 및 CUBRID broker_log_top 사용하기

    Date2009.07.28 CategoryWindows Bycubebridge Views27272
    Read More
  17. CUBRID2008R1.x to 2.0 마이그레이션 가이드 (32bit 기준)

    Date2009.08.17 CategoryLinux By정만영 Views27205
    Read More
  18. VB에서 CUBRID ODBC/OLEDB 사용하는 방법 및 샘플코드.

    Date2012.06.30 CategoryODBC/OLEDB Byseongjoon Views26927
    Read More
  19. 리소스를 제한(limits.conf) 하여 DB서버를 관리하자

    Date2015.12.31 CategoryLinux By주현 Views26642
    Read More
  20. csql(SQL 실행기) 사용법

    Date2008.11.21 Category기타 Byadmin Views26557
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 Next
/ 9

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales