473,394 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Need Help to delete records using 'recordset.Delete'

Hi All,

Below is my code to delete records:

adodcAllEntries.Recordset.MoveFirst

Do While (adodcAllEntries.Recordset.EOF = False)
If adodcAllEntries.Recordset.Fields(0) = selected_id Then
adodcAllEntries.Recordset.Delete
End If

adodcAllEntries.Recordset.MoveNext
Loop


I encountered error when the number of records to delete is >= 4 records.

Ther error is:
--------------------
Run-time error: '_2147467259 (80004005)':
Key column information is insufficient or incorrect. Too many rows were affected by update.


Can anyone help me to solve this?
Apr 1 '07 #1
4 8654
iburyak
1,017 Expert 512MB
Is it possible that recordset had a duplicate value and it is unsure which to update?

Good Luck.
Apr 1 '07 #2
Denburt
1,356 Expert 1GB
What does this recordset look like? Why can't you just run an sql statement
"Delete * from YourTable Where selected_id = " & selected_id

Or something to that effect.
Apr 1 '07 #3
What does this recordset look like? Why can't you just run an sql statement
"Delete * from YourTable Where selected_id = " & selected_id

Or something to that effect.

HI, I am very new to VB. May I know how to run that sql statement?
i mean how to write the connection first?

All the while i am using ADODCcontrol.recordsource to connect to db and bind it with DataGrid control to retrieve data. This is easy for me because i no need to write the connection code.

FYI, i am using ODBC driver to connect to db.

Your prompt reply is very much appreciated
Apr 2 '07 #4
Denburt
1,356 Expert 1GB
What type of database are you using? Is it password protected? Located on a remote server?
Apr 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: cool_dude7244 | last post by:
I am retrieving records for Customer ID as follows and displaying them as table rows with a checkbox for multiple deletion. Part of a </FORM>...
5
by: hpi | last post by:
Hello, I have a table : Batch It contains fields batchnummer : Number (Long Integer) datum : Date/Time status : Number (Long Integer) nr_records : Number (Long Integer)
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
5
by: tony010409020622 | last post by:
I just spent 4 months taking a dotnet class where i learned very little. One of the things I did not learn is this: What are the dotnet equivilents of commands such as: Adodc1.Recordset.AddNew...
0
by: isaac2004 | last post by:
im trying to make a page that reads simple user information and posts them to a table. the user can edit, delete and add new records, through a form on the page.using SQLs modifications like...
1
by: SteveBark | last post by:
Hello all I am currently trying to develop a script that will take a value from an Excel spreadsheet cell and use that to run a query against an Access table to delete all rows that match the...
5
kcdoell
by: kcdoell | last post by:
Hello: I am trying to write a code that will delete all records found in my DAO recordset Below is the code I have so far: 'Procdure to give the user the ability to delete all records 'for a...
2
kcdoell
by: kcdoell | last post by:
Hello I have a code where I want to delete the records that are found in my DAO recordset. I took a stab at this for the first time and got it to work but it is only delete one record at a time. If...
2
by: farouqdin | last post by:
Hi all i have code which loops through table and deletes the duplicate records. This code does it for one table. How do i change it so it goes through several tables? On Error Resume Next Dim...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.