J
Jamie Collins
Can anyone explain why I get different (wrong) results each time I run
the Take2 code (using ADO 2.8)?
Sub Take1()
' Create test schema and data
Kill "C:\DropMe.mdb"
Dim cat
Set cat = CreateObject("ADOX.Catalog")
With cat
.Create _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\DropMe.mdb"
With .ActiveConnection
.Properties("Jet OLEDB:Transaction Commit Mode") = 1
.Properties("Jet OLEDB:Lock Delay").Value = 1
.Execute _
"CREATE TABLE DropMe (" & _
" anything INTEGER);"
.Execute _
"INSERT INTO DropMe VALUES (1);"
End With
Set .ActiveConnection = Nothing
End With
End Sub
Sub Take2()
Dim con
Set con = CreateObject("ADODB.Connection")
With con
.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\DropMe.mdb"
.CursorLocation = 3
.Open
Dim rs
Dim counter As Long
For counter = 1 To 2
Set rs = .Execute( _
"SELECT 2147483647 + 1 FROM DropMe")
Debug.Print CStr(rs(0))
rs.Close
Next
.Close
End With
End Sub
Jamie.
--
the Take2 code (using ADO 2.8)?
Sub Take1()
' Create test schema and data
Kill "C:\DropMe.mdb"
Dim cat
Set cat = CreateObject("ADOX.Catalog")
With cat
.Create _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\DropMe.mdb"
With .ActiveConnection
.Properties("Jet OLEDB:Transaction Commit Mode") = 1
.Properties("Jet OLEDB:Lock Delay").Value = 1
.Execute _
"CREATE TABLE DropMe (" & _
" anything INTEGER);"
.Execute _
"INSERT INTO DropMe VALUES (1);"
End With
Set .ActiveConnection = Nothing
End With
End Sub
Sub Take2()
Dim con
Set con = CreateObject("ADODB.Connection")
With con
.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\DropMe.mdb"
.CursorLocation = 3
.Open
Dim rs
Dim counter As Long
For counter = 1 To 2
Set rs = .Execute( _
"SELECT 2147483647 + 1 FROM DropMe")
Debug.Print CStr(rs(0))
rs.Close
Next
.Close
End With
End Sub
Jamie.
--