前提・実現したいこと
ここに質問の内容を詳しく書いてください。
VB6で書かれたoo4oで接続するClassを
ODBC接続に変えたいのですが、どこを
どのように修正すればよいのでしょうか。
発生している問題・エラーメッセージ
該当のソースコード
VB6
1VERSION 1.0 CLASS 2BEGIN 3 MultiUse = -1 'True 4 Persistable = 0 'NotPersistable 5 DataBindingBehavior = 0 'vbNone 6 DataSourceBehavior = 0 'vbNone 7 MTSTransactionMode = 0 'NotAnMTSObject 8END 9Attribute VB_Name = "clsOo4o" 10Attribute VB_GlobalNameSpace = False 11Attribute VB_Creatable = True 12Attribute VB_PredeclaredId = False 13Attribute VB_Exposed = False 14Option Explicit 15 16Private clsUID As String 'SID 17Private clsPWD As String 'UID 18Private clsSID As String 'PWD 19 20Private clsSession As Object 'セッション 21Private clsDatabase As Object 'データベース 22Private clsStatus As String 'ORAステータス 23Private clsVbErr As Long 'VBエラーコード 24 25Const oraRec_DEFAULT = &H0& 26Const oraRec_NO_AUTOBIND = &H1& 27Const oraRec_NO_BLANKSTRIP = &H2& 28Const oraRec_READONLY = &H4& 29Const oraRec_NOCACHE = &H8& 30Const oraRec_ORAMODE = &H10& 31Const oraRec_NO_REFETCH = &H20& 32Const oraRec_NO_MOVEFIRST = &H40& 33Const oraRec_DIRTY_WRITE = &H80& 34 35Public Property Get UID() As String 36 UID = clsUID 37End Property 38 39Public Property Let UID(oraUID As String) 40 clsUID = oraUID 41End Property 42 43Public Property Let vbErr(ErrorCode As Long) 44 clsVbErr = ErrorCode 45End Property 46 47Public Property Get PWD() As String 48 PWD = clsPWD 49End Property 50 51Public Property Let PWD(oraPWD As String) 52 clsPWD = oraPWD 53End Property 54 55Public Property Get SID() As String 56 SID = clsSID 57End Property 58 59Public Property Let SID(vNewValue As String) 60 clsSID = vNewValue 61End Property 62 63Public Property Get oraSession() As Object 64 Set oraSession = clsSession 65End Property 66 67Public Property Get oraDatabase() As Object 68 Set oraDatabase = clsDatabase 69End Property 70 71Public Property Get vbErr() As Long 72 vbErr = clsVbErr 73End Property 74 75Function Connect() As Long 76On Error GoTo Connect_Err 77Dim strORASessionName As String 78 79 strORASessionName = "" 80 strORASessionName = strORASessionName & clsUID & "/" & clsPWD 81 82 Set clsSession = CreateObject("OracleInProcServer.XOraSession") 83 Set clsDatabase = clsSession.DbOpenDatabase(clsSID, strORASessionName, &H0) 84 85 clsStatus = "" 86 Connect = 0 87 88Connect_Exit: 89 Exit Function 90 91Connect_Err: 92 clsVbErr = Err 93 Connect = Err 94On Error Resume Next 95 Set clsSession = Nothing 96 Set clsDatabase = Nothing 97 GoTo Connect_Exit 98 99End Function 100 101Public Function Disconnect() As Long 102 103 On Error GoTo Disconnect_Err 104 105 Set clsSession = Nothing 106 Set clsDatabase = Nothing 107 108 Disconnect = 0 109 110Disconnect_Exit: 111 Exit Function 112 113Disconnect_Err: 114 clsVbErr = Err 115 Disconnect = Err 116On Error Resume Next 117 GoTo Disconnect_Exit 118 119End Function 120 121Public Function Execute(SQL As String) As Long 122 123 On Error Resume Next 124 125 clsDatabase.DbExecuteSQL SQL 126 127 clsVbErr = Err 128 Execute = Err 129 130End Function 131 132Public Function Recordset(SQL As String) As Object 133 134 On Error GoTo Recordset_Err 135 136 Set Recordset = clsDatabase.DbCreateDynaset(SQL, oraRec_DEFAULT) 137 138Recordset_Exit: 139 Exit Function 140 141Recordset_Err: 142 clsVbErr = Err 143 Set Recordset = Nothing 144On Error Resume Next 145 GoTo Recordset_Exit 146End Function 147 148Public Function Recordset_RO(SQL As String) As Object 149 150 On Error GoTo Recordset_RO_Err 151 152 Set Recordset_RO = clsDatabase.DbCreateDynaset(SQL, oraRec_READONLY) 153 154Recordset_RO_Exit: 155 Exit Function 156 157Recordset_RO_Err: 158 clsVbErr = Err 159 Set Recordset_RO = Nothing 160On Error Resume Next 161 GoTo Recordset_RO_Exit 162End Function 163 164Public Function CreateRecordset(SQL As String, ByVal AccessMode As Long) As Object 165 On Error GoTo CreateRecordset_Err 166 Set CreateRecordset = clsDatabase.DbCreateDynaset(SQL, AccessMode) 167CreateRecordset_Exit: 168 Exit Function 169 170CreateRecordset_Err: 171 clsVbErr = Err 172 Set CreateRecordset = Nothing 173On Error Resume Next 174 GoTo CreateRecordset_Exit 175End Function 176 177Public Function Commit() As Long 178 On Error Resume Next 179 clsDatabase.DbExecuteSQL ("BEGIN Commit; END;") 180 clsVbErr = Err 181 Commit = Err 182End Function 183 184Public Function Rollback() As Long 185 On Error Resume Next 186 clsSession.DbRollback 187 clsVbErr = Err 188 Rollback = Err 189End Function 190 191Public Function ErrReset() As Long 192 On Error Resume Next 193 clsDatabase.LastServerErrReset 194 clsVbErr = Err 195 ErrReset = Err 196End Function 197 198Public Function BeginTrans() As Long 199 On Error Resume Next 200 clsSession.DbBeginTrans 201 clsVbErr = Err 202 BeginTrans = Err 203End Function 204 205Public Function CommitTrans() As Long 206 On Error Resume Next 207 clsSession.DbCommitTrans 208 clsVbErr = Err 209 CommitTrans = Err 210End Function 211
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。