D
diffbridge
Unregistered / Unconfirmed
GUEST, unregistred user!
用ado 读取Access中数据类型为ole (长二进制blob)数据为乱码?请教<br>我用好几种方式多是乱码<br>一。<br>var<br> Buffer: PChar;<br> MemSize: Integer;<br> Stream: TBlobStream;<br>begin<br> Stream := TBlobStream.Create(ADOTable1.FieldByName('zc') as TBlobField, bmRead);<br> try<br> MemSize := Stream.Size;<br> Inc(MemSize); {Make room for the buffer's null terminator.}<br> Buffer := AllocMem(MemSize); {Allocate the memory.}<br> try<br> Stream.Read(Buffer^, MemSize); {Read Notes field into buffer.}<br> Memo1.SetTextBuf(Buffer); {Display the buffer's contents.}<br><br> finally<br> FreeMem(Buffer, MemSize);<br> end;<br> finally<br> Stream.Free;<br> end;<br>二<br>ms:=TmemoryStream.create();<br>TBlobField(ADOTable1.FieldByName('aa')).SaveToStream(ms);<br>ms0.position:=0;<br>memo1.Lines.LoadFromStream(ms)