BCB实现BLOB字段的读写[VC/C++编程]
本文“BCB实现BLOB字段的读写[VC/C++编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
关于SQL中的TEXT、IMAGE、MEMO字段的存取,可以采取下列程序:
BLOB字段的读取:
TBlobSTream* TemplateStream;
char* TempPlatePtr;
TemplateStream=new TBlobStream((TBlobField*)WebQuery->FieldByName
("SearchTem"),bmReadWrite);
TemplatePtr= new char[TemplateStream->Size];
TemplateStream->Read(TemplatePtr, TemplateStream->Size);
BLOB字段的写入:
TBlobSTream* TemplateStream;
char* TempPlatePtr;
TemplateStream=new TBlobStream((TBlobField*)WebQuery->FieldByName
("SearchTem"),bmReadWrite);
TemplatePtr= new char[TemplateStream->Size];
TemplateStream->Write(TemplatePtr, TemplateStream->Size);
________________________________________________________________
增补:
得到字段的大小用函数datalength
SQL Server端要作一点设置:
By default, WRITETEXT is a nonlogged operation. This means that
text or image data is not logged when it is written into the database.
To use WRITETEXT in its default, nonlogged state,
//注意!!
the system administrator must use the sp_dboption system stored
procedure to set select into/bulkcopy,
//
which allows nonlogged data to be inserted.
做了试验,直接写SQL语句好象不行.
____________________________________________________________________
以上是“BCB实现BLOB字段的读写[VC/C++编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |