Current recordset does not support updating in vb6


If you don't use Edit first, an error occurs when you use Update or attempt to change a field's value.

In an ODBCDirect workspace, you can do batch updates, provided the cursor library supports batch updates, and the Recordset was opened with the optimistic batch locking option.

Cancel Update Msg Box "No new record added." End If . Close End Sub Sub Batch X() Dim wrk Main As Workspace Dim con Main As Connection Dim rst Temp As Recordset Dim int Loop As Integer Dim str Prompt As String Set wrk Main = Create Workspace("ODBCWorkspace", _ "admin", "", db Use ODBC) ' This Default Cursor Driver setting is required for ' batch updating. Default Cursor Driver = db Use Client Batch Cursor ' Note: The DSN referenced below must be configured to ' use Microsoft Windows NT Authentication Mode to ' authorize user access to the Microsoft SQL Server. Open Connection("Publishers", _ db Driver No Prompt, False, _ "ODBC; DATABASE=pubs; DSN=Publishers") ' The following locking argument is required for ' batch updating. If str First Name "" Then ' Call the function that adds the record.

" If Msg Box(str Prompt, vb Yes No) = vb Yes Then _ . str First Name = Trim(Input Box( _ "Enter first name:")) str Last Name = Trim(Input Box( _ "Enter last name:")) ' Proceed only if the user actually entered something ' for both the first and last names. Last Name ' Delete new record because this is a demonstration.

current recordset does not support updating in vb6-24current recordset does not support updating in vb6-19current recordset does not support updating in vb6-42current recordset does not support updating in vb6-9

Close End Sub Sub Add New X() Dim dbs Northwind As Database Dim rst Employees As Recordset Dim str First Name As String Dim str Last Name As String Set dbs Northwind = Open Database("Northwind.mdb") Set rst Employees = _ dbs Northwind. Close End Sub Function Add Name(rst Temp As Recordset, _ str First As String, str Last As String) ' Adds a new record to a Recordset using the data passed ' by the calling procedure. Update ********* This looks ok to me; but the program doesn't like it. Add New line, it falls over, complaining: ********* Run time error '3251' Current Recordset does not support updating.Run time error 3251 Current Recordset does not support updating, this may be a limitation of the provider, or of the selected Locktype This is my simple program that will split the entries that have 2 words in it and put it in separate fields: im using MSaccess for my tables for example: before field1= word1, word2 after: field1 = word1 field2= word2 Before you can change field values, you need to issue an Edit against the record. I'm guessing I'm opening this wrongly, and as a result updates are forbidden (as is reading backwards, as I've tried doing a Move Last, which also causes problems). Open "SELECT * FROM My Table", obj Conn, ad Open Keyset, ad Lock Optimistic, ad Cmd Text The reason the other code doesn't work is that the connection object's recordset is read-only, forward-only. The database is one I created in access, it's indexed by an automatically incredmenting number.If the record has changed since you used the Edit method, the Update operation fails. str Message = "Edit in progress:" & vb Cr & _ " Original data = " & str Old First & " " & _ str Old Last & vb Cr & " Data in buffer = " & _ ! Last Name & vb Cr & vb Cr & _ "Use Update to replace the original data with " & _ "the buffered data in the Recordset?

You must have an account to comment. Please register or login here!