• 9018阅读
  • 3回复

【提问】谁能告诉我Qt处理二进制文件向数据库存储的思路吗? [复制链接]

上一主题 下一主题
离线mzy
 
只看楼主 倒序阅读 楼主  发表于: 2005-09-03
想把学习从一开始就放到Qt上,不知道Qt对windows下的数据库如:Access,SQL Server的访问是如何实现操作BLOB字段的.

上google搜索,只发现了在VC下有DAO ADO可以处理二进制数据流, 在QT下用ODBC是怎么实现的呢?   各位大侠,路过看过,能给个思路吗?

谢谢.
[ 此贴被XChinux在2005-09-03 16:34重新编辑 ]
离线XChinux

只看该作者 1楼 发表于: 2005-09-03
QVariant QSqlResult::data ( int index ) [pure virtual protected]
Returns the data for field index in the current row as a QVariant. This function is only called if the result is in an active state and is positioned on a valid record and index is non-negative. Derived classes must reimplement this function and return the value of field index, or QVariant() if it cannot be determined.

不知道这个对你有用没用。没详细看过这方面的东西。应该是可以读写二进制数据的
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线yfy002

只看该作者 2楼 发表于: 2005-09-05
QByteArray s = query.value(nameCol).toByteArray();//读取二进制对象


this is a example to write a pixmap into database
QByteArray pngImage;
QBuffer buffer(&pngImage);
buffer.open(QIODevice::WriteOnly);
upimage.save(&buffer, "PNG"); // writes upimage into bytes in PNG format            
......
query.bindValue(7,pngImage,QSql::Binary);
我渴望平静,风却给了我涟漪
我的blog:
http://sungaoyong.cublog.cn
离线mzy
只看该作者 3楼 发表于: 2005-11-15
谢谢两位。程序完成后再请指教。
快速回复
限100 字节
 
上一个 下一个