How to UPDATE or DELETE record with DQuest

20 views
Skip to first unread message

Nguyễn Tấn Việt

unread,
Jul 24, 2013, 5:35:30 AM7/24/13
to dques...@googlegroups.com
Hi all,

I have downloaded the DQuest package here and implement it in my Qt project. It's really a useful library. I also read the tutorials to understand more about it. But I didn't find the way to update/delete record in database. Could you please give me some ideas or solutions to update record?


Thanks!
Viet.

Ben Lau

unread,
Jul 24, 2013, 10:26:58 AM7/24/13
to dques...@googlegroups.com
Hi Nguyễn Tấn Việ,

It is nice to hear that DQuest is useful for you. The delete and update of SQL can be done through the save() and remove() function on DQModel.

--
You received this message because you are subscribed to the Google Groups "dquest-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dquest-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Nguyễn Tấn Việt

unread,
Aug 15, 2013, 7:26:34 AM8/15/13
to dques...@googlegroups.com
Hi Ben Lau,

Thanks for your quickly response! I have tried to use 2 methods you had given to update and remove records in Database. But it doesn't help me solve the problem. Details:

+ remove() function doesn't remove any records. I also check the result carefully.
+ save() function helps me create/update record well. It is a good function. But when I only wanna update a field in table then I have to update all other fields in table unless the data in field will be empty. I don't understand what the reason is. 

This is the code that I used to update records

            Family family;

            if (family.load(DQWhere("FamilyID") == 1)) {

                family.FamilyID = family_id_value;
                family.Name = family.Name->toString();
                family.Address = family.Address->toString();
                family.Address2 = family.Address2->toString();
                family.City = family.City->toString();
                family.Country = family.Country->toString();
                family.Email = email;
                
                family.save();
            }

As you see, I have to update all fields in table when I only want to update field Email.

Do you have any ideas?

Thanks!

Vào 21:26:58 UTC+7 Thứ tư, ngày 24 tháng bảy năm 2013, Ben Lau đã viết:
Reply all
Reply to author
Forward
0 new messages