在VC ++中插入,删除数据库中记录的方法 [英] Methods to insert,delete records in database in vc++

查看:93
本文介绍了在VC ++中插入,删除数据库中记录的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vc ++中插入,删除数据库中记录的方法?我已经使用CDatabase使用ExecuteSQl.可以使用任何其他方法来插入,删除和更新MYSQL数据库中的记录.


Methods to insert,delete records in database in vc++? I have used ExecuteSQl using CDatabase. Any other method is there in order to insert, delete and update records in MYSQL Database.


     CLongBinary m_BLOBImage;
CFileStatus fileStatus;
strfile.GetStatus(fileStatus);
    CString m_BLOBName = strfile.GetFileTitle();
    m_BLOBImage.m_dwDataLength = fileStatus.m_size;
SIZE_T dwbytes=(SIZE_T)fileStatus.m_size;
    HGLOBAL hGlobal     = GlobalAlloc(GPTR,dwbytes);
    m_BLOBImage.m_hData = GlobalLock(hGlobal);
strfile.Read(dbImages.m_BLOBImage.m_hData,(UINT)fileStatus.m_size);

推荐答案

您可以使用CRecordset类.
CRecordset的构造函数中指定CDatabase指针.
此类具有AddNewDeleteEditUpdate等方法,它们可以为您完成工作.
You can use the CRecordset class.
Specify the CDatabase pointer in the constructor of CRecordset.
This class had methods like AddNew, Delete, Edit, Update etc. that will do the job for you.


这篇关于在VC ++中插入,删除数据库中记录的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆