|
 |
activex_data_objects thread: Awesome 'Error '-2147217915 (80040E05)' with ADO Recordset.Requery method!!!!!!
Message #1 by sierracebrian@p... on Sun, 25 Aug 2002 05:40:39
|
|
PROBLEM: Getting non trappable runtime error (even when going into the ado
connection.errors collection, it is *NOT* trappable, error 3704 (Object
closed) when doing a requery in any flavour you think of; AdAffecCurrent,
Group or AllChapters, no matter what.
WHAT I AM DOING??? The following code is written in VB 6.0, having
installed MDAC 2,71 and SP5 for VB, also running the JET Engine Version 4.0
with SP3. This following code trhows no error at all, I can do UdateBatch,
Transactions (Begin,Commit and RollBack), add or delete records to the
parent and to the child recordset, anything! but it breaks down when
calling RsParent.Requery or RsParent.Resync
PLEASE HELP ME OUT!! I´M VERY FRUSTRATED WITH THIS!
THANKS IN ADVANCE!
CARLOS SIERRA FROM MEXICO
*SEE THE FOLLOWING CODE*
Option Explicit
Public RsParent As New ADODB.Recordset
Public RsChild As New ADODB.Recordset
Public Cmd As New ADODB.Command
Public Cnx As New ADODB.Connection
Public Sub PrepareData()
Dim strCS As String, txtSQL As String
strCS = "Provider=MSDataShape.1;Persist Security Info=False;" & _
"Data Source=C:\Archivos de programa\ObjGen 2.1
Demo\Nwind.mdb;" & _
"Data Provider=MICROSOFT.JET.OLEDB.4.0"
txtSQL = "SHAPE {SELECT * FROM `Customers`} AS Customers " & _
"APPEND ({SELECT * FROM `Orders`} AS Orders " & _
"RELATE 'CustomerID' TO 'CustomerID') AS Orders"
'First, prepare and open the connection object
With Cnx
.ConnectionString = strCS
.CursorLocation = adUseClient
.Mode = adModeShareDenyNone
.Open
End With
'Then go with the command object
With Cmd
.CommandText = txtSQL
.ActiveConnection = Cnx
.CommandType = adCmdText
End With
'Then go with the recordsets
With RsParent
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.CursorLocation = adUseClient
.StayInSync = True
.Properties("Unique Table") = "Customers"
End With
With RsChild
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.CursorLocation = adUseClient
.StayInSync = True
.Properties("Unique Table") = "Orders"
End With
'At Last, create both recordsets and work with em'
Set RsParent = Cmd.Execute
'*or do this, for an adding-deleting capable recordset**
RsParent.Open txtSQL, Cnx, adOpenStatic, adLockBatchOptimistic, adCmdText
If Not (RsParent.EOF And RsParent.BOF) Then
RsParent.MoveLast
RsParent.MoveFirst
Else
RsParent.Move 0
End If
Set RsChild = RsParent.Fields("Orders").UndelyingValue
End Sub
PROBLEM COMES UP WHEN CALLING:
RsParent.Requery
or
RsParent.Requery AdAffectCurent
or
RsParent.Requery AdAffectGroup 'when using filter
or
RsParent.Requery AdAffectAllChapters
or
RsParent.Resync
or
RsParent.Resync AdAffectCurrent
or
RsParent.Resync AdAffectGroup
or
RsParent.Resync AdAffectAllChapters
Message #2 by sierracebrian@p... on Sun, 25 Aug 2002 05:51:11
|
|
PROBLEM: Getting non trappable runtime error (even when going into the ado
connection.errors collection, it is *NOT* trappable, Error '-2147217915
(80040E05) an Object has been Opened' when doing a requery in any flavour
you think of; AdAffecCurrent, Group or AllChapters, no matter what.
WHAT I AM DOING??? The following code is written in VB 6.0, having
installed MDAC 2,71 and SP5 for VB, also running the JET Engine Version 4.0
with SP3. This following code trhows no error at all, I can do UdateBatch,
Transactions (Begin,Commit and RollBack), add or delete records to the
parent and to the child recordset, anything! but it breaks down when
calling RsParent.Requery or RsParent.Resync
PLEASE HELP ME OUT, I AM VERY VERY FRUSTRATED AFTER HAVING INVESTED A LOT
OF TIME & EFFORT TO LEARN THE SHAPE LANGUAGE AND PALNNED AND TRACED OUT AN
ENTIRE APP WITH THIS PROVIDER!
THANKS IN ADVANCE!!
CARLOS SIERRA FROM MEXICO
*SEE THE FOLLOWING CODE*
Option Explicit
Public RsParent As New ADODB.Recordset
Public RsChild As New ADODB.Recordset
Public Cmd As New ADODB.Command
Public Cnx As New ADODB.Connection
Public Sub PrepareData()
Dim strCS As String, txtSQL As String
strCS = "Provider=MSDataShape.1;Persist Security Info=False;" & _
"Data Source=C:\Archivos de programa\ObjGen 2.1
Demo\Nwind.mdb;" & _
"Data Provider=MICROSOFT.JET.OLEDB.4.0"
txtSQL = "SHAPE {SELECT * FROM `Customers`} AS Customers " & _
"APPEND ({SELECT * FROM `Orders`} AS Orders " & _
"RELATE 'CustomerID' TO 'CustomerID') AS Orders"
'First, prepare and open the connection object
With Cnx
.ConnectionString = strCS
.CursorLocation = adUseClient
.Mode = adModeShareDenyNone
.Open
End With
'Then go with the command object
With Cmd
.CommandText = txtSQL
.ActiveConnection = Cnx
.CommandType = adCmdText
End With
'Then go with the recordsets
With RsParent
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.CursorLocation = adUseClient
.StayInSync = True
.Properties("Unique Table") = "Customers"
End With
With RsChild
.CursorType = adOpenDynamic
.LockType = adLockBatchOptimistic
.CursorLocation = adUseClient
.StayInSync = True
.Properties("Unique Table") = "Orders"
End With
'At Last, create both recordsets and work with em'
Set RsParent = Cmd.Execute
'Or, for a fully editable recordset, we do:
RsParent.Open txtSQL, Cnx, adOpenStatic, adLockBatchOptimistic, adCmdText
If Not (RsParent.EOF And RsParent.BOF) Then
RsParent.MoveLast
RsParent.MoveFirst
Else
RsParent.Move 0
End If
Set RsChild = RsParent.Fields("Orders").UndelyingValue
End Sub
PROBLEM COMES UP WHEN CALLING:
RsParent.Requery
or
RsParent.Requery AdAffectCurent
or
RsParent.Requery AdAffectGroup 'when using filter
or
RsParent.Requery AdAffectAllChapters
or
RsParent.Resync
or
RsParent.Resync AdAffectCurrent
or
RsParent.Resync AdAffectGroup
or
RsParent.Resync AdAffectAllChapters
|
|
 |