how to connect to oracle in vb6 (sql statement)


thanks
turbot_yuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LambersonSoftware EngineerCommented:
0
Ryan ChongCommented:
I'm using this module to deal with database... see if it may helpful to you as well:


'Version 1.1.13
'Author: Chong Yit Seng (ryancys @ g mail com)
'Last Updated: 2 Mar 2006

Public Enum ComboCompareUsing
    itemData = 1
    Text = 2
End Enum

Public conn As ADODB.Connection
Public rs As ADODB.Recordset
Public SQLstr As String
Public modconnString As String
Public cmd As ADODB.Command

Public Sub setConnString(ConnString As String)
    modconnString = ConnString
End Sub

'Ver 1.3
Public Function OpenConn(xconn As ADODB.Connection, Optional ConnString As String = "", Optional remainOpenIfAlreadyOpened As Boolean = False) As Boolean
    On Error GoTo EH
    'Open Connection
    If Not xconn Is Nothing Then
        If xconn.state = adStateOpen Then
            If remainOpenIfAlreadyOpened Then
                OpenConn = True
                Exit Function
            Else
                xconn.Close
            End If
        End If
    End If
   
    Set xconn = New ADODB.Connection
    xconn.ConnectionString = IIf(ConnString = "", modconnString, ConnString)
    xconn.CursorLocation = adUseClient
    xconn.Open
    OpenConn = (xconn.state = adStateOpen)
    Exit Function
EH:
    OpenConn = False
End Function

'Ver 1.1
Public Function CloseConn(xconn As ADODB.Connection) As Boolean
    On Error GoTo EH
    'Close Connection
    If Not xconn Is Nothing Then
        If xconn.state = adStateOpen Then xconn.Close
        Set xconn = Nothing
    End If
    CloseConn = True
    Exit Function
EH:
    CloseConn = False
End Function

'Ver 1.2
Public Function OpenRS(xrs As ADODB.Recordset, xconn As ADODB.Connection, ByVal SQL As String) As Boolean
    On Error GoTo EH
    'Open RecordSet
    If Not xconn Is Nothing Then
        If xconn.state = adStateClosed Then xconn.Open
        Set xrs = New ADODB.Recordset
        xrs.Open SQL, xconn, adOpenKeyset, adLockOptimistic
    End If
    OpenRS = (xrs.state = adStateOpen)
    Exit Function
EH:
    OpenRS = False
End Function

'Ver 1.1
Public Function CloseRS(xrs As ADODB.Recordset) As Boolean
    On Error GoTo EH
    'Close RecordSet
    If Not rs Is Nothing Then
        If rs.state = adStateOpen Then rs.Close
        Set rs = Nothing
    End If
    CloseRS = True
    Exit Function
EH:
    CloseRS = False
End Function

Public Function ReplaceQuote(v As String) As String
    ReplaceQuote = Replace$(v, "'", "''", , , vbTextCompare)
End Function

'Ver 1.1
Public Function formatSQLDate(d As Date, Optional formatString As String = "mm/dd/yyyy hh:nn:ss") As String
    formatSQLDate = Format$(d, formatString)
End Function

'Ver 1.0
Public Function formatEngDate(d As Date, Optional formatString As String = "dd/mm/yyyy") As String
    formatEngDate = Format$(d, formatString)
End Function
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
WimCommented:
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.