Article ID: 172313
Article Last Modified on 3/2/2005
Cn.QueryTimeout = 0
Option Explicit
Dim Ws As Workspace
Dim Cn As Connection
'
' Note that the parameters in the connection string must be changed
' to match your configration.
Private Sub Command1_Click()
On Error Resume Next
MousePointer = vbHourglass
Cn.Execute "DROP TABLE CODETEST"
Cn.Execute "CREATE TABLE CODETEST(CODE VARCHAR2(10) NULL)"
MousePointer = vbNormal
MsgBox "Table Created"
End Sub
Private Sub Command2_Click()
Dim strSQL As String
Dim Qd As QueryDef
Dim txtValue As String
txtValue = "abc"
Ws.BeginTrans
strSQL = "insert into codetest (code) values ('" & txtValue & "')"
Set Qd = Cn.CreateQueryDef("", strSQL)
Qd.Execute 'Fails here the second time
If (Err.Number <> 0) Then
MsgBox ("[cmdExecute_Click] - " + Err.Description)
Else
Qd.Close
End If
Ws.CommitTrans
MsgBox "Click me again and I will crash"
End Sub
Private Sub Form_Load()
Dim strConn As String
Command1.Caption = "Create Table"
Command2.Caption = "Enter Data"
'Replace <data source name>, <user ID>, and <password> with the
'DSN, user ID, and password for your Oracle system.
strConn = "odbc;dsn=<data source name>; _
uid=<user ID>;pwd=<password>"
Set Ws = CreateWorkspace("", "admin", "", dbUseODBC)
Set Cn = Ws.OpenConnection("", dbDriverNoPrompt, False, strConn)
'Cn.QueryTimeout = 0 ' This is the workaround line of code
End Sub
Private Sub Form_Unload(Cancel As Integer)
Cn.Close
Ws.Close
End Sub
Additional query words: kbODBC kbOracle kbDatabase kbDriver kbVB kbDAO
Keywords: kbbug kbfix kbodbc200fix kboracle kbdriver kbmdacnosweep KB172313