I am using DataGrid with Ado connection in Vb6. Whenever I update some columns of DataGrid I getting error "Recordset can not be located. Too many rows effected....." . Please tell me how to rectify this error.
Is the error message "recordset cannot be located" or "recordset cannot be updated"? If it is the second, you are probably getting this error because there is no unique identifier for each row in the recordset, so ADO cannot determine which record to update.
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
Suggest you read faq222-2244 carefully and then clarify your question. You have not given enough information for us to provide complete answers
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?' Essex Steam UK for steam enthusiasts
The error description says it found more than one record identical to the one you are trying to update, and because you want to update only one record to the recordset at a time (non-bulk update) it prevents a mistake from happening.
When a record is to be updated, ADO needs to know where it is. It does this by using the assigned primary or unique key and then does a search in the table for it. If there isn't a unique key, then it tries to identify the record by finding matching uniqness across all fields. If it still cannot find a unique record, you will get this error.
Be sure to add and include a primary or unique field, or combination of fields (Main object ID and secondary Object ID together to provide a unique key where no other record has this combination) to your table and include it in the recordset - even if it is just an Auto Number field not being used for anything else.
Thanks to SDuke. I was trying to connect datagrid with connection code instead of ado data control. Still it was not working. But as suggested I just added a field in the table with autonumber, it is working fine. Now I have another problem. I am trying to add records by command button as follows:
now datagrid first colum is populated with 345 (binded with recordset employee no) but not other columns (table is having default values for all fields) When I move to next record the error is (like)
"Recordset can not be located. Too many rows are affected since last read"
in debug mode it is pointing the code line where datagrid.columns.text is compared with other variables.
Please advise me how to fix it. Thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.