function GetBlobFieldData |
尚未結案
|
LPH
一般會員 發表:53 回覆:43 積分:19 註冊:2003-04-02 發送簡訊給我 |
|
turboted
版主 發表:95 回覆:754 積分:452 註冊:2002-07-23 發送簡訊給我 |
這個function 好像真的滿少資料
而且我也不知道您是那一個元件的GetBlobFieldData
參考看看吧 TDataSet::GetBlobFieldData
GetBlobFieldData reads blob data from the field specified by FieldNo into a Buffer. The buffer is a dynamic array of bytes, so that it can grow to accommodate the size of the BLOB data. GetBlobFieldData returns the size of the buffer. TCustomADODataSet::GetBlobFieldData
Most applications do not need to call GetBlobFieldData, this method being used internally by descendants of TCustomADODataSet. GetBlobFieldData reads blob data from the field specified by FieldNo into a Buffer. The buffer is a dynamic array of bytes, so that it can grow to accommodate the size of the BLOB data. GetBlobFieldData returns the size of the buffer. TBDEDataSet::GetBlobFieldData
GetBlobFieldData reads blob data from the field specified by FieldNo into a Buffer. The buffer is a dynamic array of bytes, so that it can grow to accommodate the size of the BLOB data. GetBlobFieldData returns the size of the buffer.
|
mustapha.wang
資深會員 發表:89 回覆:409 積分:274 註冊:2002-03-13 發送簡訊給我 |
很简单呀,你定义一个TBlobByteData类型的变量就行了,如
var AData:TBlobByteData; begin ADOQuery1.Open; ADOQuery1.GetBlobFieldData(2,AData);你看看delphi的DB.pas的原码: function TDataSet.GetBlobFieldData(FieldNo: Integer; var Buffer: TBlobByteData): Integer; var Stream: TStream; begin Stream := CreateBlobStream(FieldByNumber(FieldNo) as TBlobField, bmRead); try Result := Stream.Size; if Result > 0 then begin if Length(Buffer) <= Result then SetLength(Buffer, Result Result div 4); Stream.Read(Buffer[0], Result); end; finally Stream.Free; end; end;它自己跟你分配AData的大小,不用考虑够不够。剩下的问题是看你如何使用AData,你也可以这样获得blob的资料: var MS:TMemoryStream; begin ADOQuery1.Open; MS:=TMemoryStream.Create; TBlobField(ADOQuery1.Fields[2]).SaveToStream(MS);
------
江上何人初见月,江月何年初照人 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |