there can be a number of problems:
if your query is a join for example. or any other such "complex" sql.
or you have some master-detail or similar setup probably not configured correctly
or etc.
so .. what is your query looking like? (the sql) what otehr modifications have you made to the query and connection?
Main Topics
Browse All Topics





by: developmentguruPosted on 2007-11-21 at 05:52:15ID: 20327593
It may help to see the query that is active at the time you are trying to do the insert. Certain queries can produce result sets that are not easily updatable. Are all of the fields in the same table?
You should check the values of the CursorLocation and CursorType properties (both at design time and ruin time). If the cursor location is clUseClient then the only valid CursorType is stStatic. I would set the cursor location to ctServer and the CursorType to ctKeySet or ctDynamic and see if it works.
Personally I use the ADOQuery to populate a TClientDataset and browse off of that. This will allow you to edit everything in memory and discard changes if you wish. This works best with a relatively small set of records although I have done it with roughly 20,000). Once the user decides to accept their changes you can cycle through the dataset looking for records whos fields that have been modified or added. In general added records will have no auto populated ID (one way to test for an inserted record). Generally I use insert and update query statements to update the database (using transactions if appropriate), then repopulate my ClientDataset from the database.
Let me know if you need more.