|
-
June 24th, 1999, 06:10 AM
#1
CRecordSet
Hi,
I have created a MFC Appwizard(DLL). I have derived a class from CRecordSet. I haven't implemented bulk data exchange. While I Edit or Delete or AddNew or Update a record assertion failure results. Can you help me to solve this problem.
Thank you.
With regards,
Patricia
-
June 24th, 1999, 06:16 AM
#2
Re: CRecordSet
What exactly is the error?
I assume you are using a pointer to the recordset.
It could be something to do with the way you are calling your recordset....Is the recordset definitely open (I am not trying to be patronising or anything).
Or it could be something to do with the connection between the code and the database...are you using ODBC?
SB
-
June 24th, 1999, 07:00 AM
#3
Re: CRecordSet
Hi,
Thank you for your answer. I'm using pointer to CRecordSet and ODBC. I can use the values of the fields using m_ that field name. Also I can access the other member functions such as Open, Close, MoveFirst, etc. But I'm not able to access Edit or Delete or Update member functions. I don't know the reason.
Can you suggest other ways to update a row in a database? Thank you.
With regards,
Patricia
-
June 24th, 1999, 07:41 AM
#4
Re: CRecordSet
I had a problem like this a while back and was tearing my hair out in frustration until I realised that the ODBC had been initialised as read only. Do you have a CDatabase pointer? Check out the initialisation for this.
I'll look up my code and get back to you.
SB
-
June 25th, 1999, 03:53 AM
#5
Re: CRecordSet
Hello,
I'm eagerly waiting for your reply. I've not yet solved the problem. Please do help me to solve. Thank you.
With Regards,
Patricia
-
July 2nd, 1999, 05:07 PM
#6
Re: CRecordSet
I have run into similar problems. What I found to work is the following:
If you want to insert\update\delete a record, call Open() with the following
parameters:
::Open(CRecordset: ynaset, 0, CRecordset::executeDirect);
Then, if you want to be sure your recordset has the correct permissions to
modify the table, you can call the following CRecordset member functions,
depending on what you need to do:
CanAppend()
CanUpdate()
CanTransact()
-
May 31st, 2000, 04:45 PM
#7
Re: CRecordSet
Your problem may have to do with MS SQL if you are using it.
Check out the following artical from microsoft
Q136994
(you can mail [email protected], and put Q136994 in the subject line).
-
June 1st, 2000, 01:38 PM
#8
Re: CRecordSet
Hiya,
This should solve your problem:
1) Make sure your data source is not read-only.
2) When you use CRecordSet::Open,by default the recordset is updatable unless you specified something else for the "dwoptions" parameter. Check the Help for CRecordSet::Open.
3) To verify #2, use the CRecordSet::CanUpdate command. It will return 1 if the recordset you open is updatable.
This assuming that all other recordset configurations (pointers, etc.) are correct.
Hope this helps.
Sam the Record Man
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|