Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operation Cancelled - Run-time error -2147217842

Status
Not open for further replies.

demoman

Programmer
Oct 24, 2001
242
US
Howdy!

I have a form with a number of text boxes bound to an ADODC control. The form can be used for new entry, or for editing (depending on user selection).

If it is new entry, the adoProject.Recordset.Addnew method is fired. I am getting the above error when that happens. The thing is, I can just hit continue and the program ignores the previous error, a new record is placed in the buffer and can be saved normally.

In edit mode, I get the same error, but this time it is when I envoke the .MoveFirst method. Again, the program then functions fine.

The ado settings are:

Client/Dynamic/Optimistic/Unknown/Unknown
ConnectionString is a DSN (Sqlserver 2000)
RecourSource="Select * from Projects Where Active = 1"
everything else are the defaults - pretty vanilla

Any suggestions out there?
 
If you modify anything in the form, since it is bound, it will put the recordset into update mode. If you try to go to another record, either by addnew or move*, ADO will try to commit the changes automatically. I don't use bound controls, so I don't know exactly what they are doing. Maybe there's a setting that forces a cancel operation if you don't expressly do an update operation.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Thanks for the reply! Yes, that makes sense. I can change the default mode setting to read-only until the user makes a selection. Either that or just trap the error and move on. Like you, I usually do not use bound controls, but I was feeling lazy. You would think that after 20 years I might figure out there are no short-cuts without penalty points.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top