|
-
Nov 4th, 2007, 06:11 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Problem in ado code
I have creating a data management program with ado code.
But when I use Addnew or delete command I can see this error
Code:
3251 - Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.
What is the meaning of this error statement.
How can I solve it?
If above question or answer will help to you
Don't forget to rate me
தமிழ்இன்பன்
-
Nov 4th, 2007, 06:21 AM
#2
Re: Problem in ado code
how are you opening your recordset?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 4th, 2007, 06:29 AM
#3
Thread Starter
Addicted Member
Re: Problem in ado code
Code:
Dim mobjADOConn As ADODB.Connection
Dim mobjADORst As ADODB.Recordset
Dim mstrSQL As String
'local variable(s) to hold property value(s)
Private sWorkTable As String 'local copy
private sub connect()
Dim sConnectionString As String
sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Source-Z.mdb;Persist Security Info=False"
' Connect to the Property database:
Set mobjADOConn = New ADODB.Connection
mobjADOConn.ConnectionString = sConnectionString
mobjADOConn.Open
Dim lngX As Long
'select or reload the data to be displayed:
mstrSQL = "select * from " & sWorkTable
Call OpenNewRecordset
End sub
'-----------------------------------------------------------------------------
Private Sub OpenNewRecordset()
'-----------------------------------------------------------------------------
Set mobjADORst = New ADODB.Recordset
mobjADORst.CursorLocation = adUseClient
mobjADORst.Open mstrSQL, mobjADOConn, adOpenStatic, , adCmdText
End Sub
If above question or answer will help to you
Don't forget to rate me
தமிழ்இன்பன்
-
Nov 4th, 2007, 07:06 AM
#4
Re: Problem in ado code
Constant Description
adOpenForwardOnly Forward-only cursor. Default. Identical to a static cursor except that you can only scroll forward through records. This improves performance in situations when you need to make only a single pass through a recordset.
adOpenKeyset Keyset cursor. Like a dynamic cursor, except that you can't see records that other users add, although records that other users delete are inaccessible from your recordset. Data changes by other users are still visible.
adOpenDynamic Dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the recordset are allowed, except for bookmarks if the provider doesn't support them.
adOpenStatic Static cursor. A static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible.
static is read only, use dynamic
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Nov 4th, 2007, 07:13 AM
#5
Re: Problem in ado code
Also, you are not specifying a locktype. It defaults to adLockReadOnly.
See this on lock types:
http://msdn2.microsoft.com/en-us/library/ms680855.aspx
-
Nov 4th, 2007, 02:37 PM
#6
Re: Problem in ado code
Try:
Code:
mstrSQL = "select * from " & sWorkTable
Debug.Print mstrSQL
Occam's Razor...
-
Nov 4th, 2007, 02:56 PM
#7
Re: Problem in ado code
When you open a recordset without specifying any of the arguments it create a forward-only read-only recordset.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
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
|