|
-
Apr 14th, 2006, 11:37 AM
#1
Thread Starter
New Member
Problem With Refreshing Recordset
Why doesn't my recordset return the updated values? Everytime I add, update or delete a record and requery the recordset, it always returns the original values that does not reflect the new changes. How do I solve This? Please Help!
-
Apr 14th, 2006, 11:41 AM
#2
Member
Re: Problem With Refreshing Recordset
-
Apr 14th, 2006, 11:57 AM
#3
Thread Starter
New Member
Re: Problem With Refreshing Recordset
tried it but same result. I'm using vb6 and ms-access as the database
-
Apr 14th, 2006, 12:04 PM
#4
Thread Starter
New Member
Re: Problem With Refreshing Recordset
Here's the code on how is connect and get the recordset
VB Code:
Option Explicit
Public conDB As New ADODB.Connection
Public adoCom As New ADODB.Command
-----------------------------------------------------------------------------------
Public Function openConnectionDB(connection_string As String) As Boolean
conDB.ConnectionString = connection_string
conDB.Mode = adModeUnknown
conDB.CursorLocation = adUseClient
conDB.ConnectionTimeout = 1
On Error GoTo ConnectionFailed
conDB.Open
openConnectionDB = True
Exit Function
ConnectionFailed:
MsgBox Err.Description, vbCritical
openConnectionDB = False
End Function
-----------------------------------------------------------------------------------
Public Function getRecordset(SQLQuery As String) As ADODB.Recordset
On Error GoTo GetRecordsetFailed
Dim rs As New ADODB.Recordset
If (rs.State = 1) Then
rs.Close
End If
Set rs.ActiveConnection = Me.conDB
rs.CursorLocation = adUseClient
rs.CursorType = adOpenForwardOnly
rs.CacheSize = 50
rs.LockType = adLockOptimistic
rs.Source = SQLQuery
rs.Open
Set getRecordset = rs
Exit Function
GetRecordsetFailed:
Set getRecordset = Nothing
MsgBox Err.Description, vbCritical
Exit Function
End Function
Last edited by si_the_geek; Apr 14th, 2006 at 12:42 PM.
Reason: added VBCode tags
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|