SQL2008, data types as follows: the image in the DELPHI if converted to character and then saved to a text file?
How the data types as follows: image in DELPHI found out first, then save the TXT?
Thank you very much!!!!!!!!!!!!!!!
CodePudding user response:
Such as online ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
CodePudding user response:
Read it is a stream, you can move directly to the flow (function) to the string, but may be garbled
Or traverse flow, each byte into hexadecimal string
CodePudding user response:
Can you specific points? A novice
CodePudding user response:
refer to the second floor BDMH response: read a stream, you can move directly to the flow (function) to the string, but may be garbled Or traverse flow, each byte into hexadecimal string Can you specific points? A novice CodePudding user response:
Is a image file? Should have no problem with base64 encoding for storage, after, SQL 2000, using DELPHI ADOQuery query out later, can be directly ADOQuery. FiledByName (' image '). Asstring; The use base64 encoding can, if direct assignment to string is no good! CodePudding user response:
reference 5 floor nm_wyh reply: is a image file? Should have no problem with base64 encoding for storage, after, SQL 2000, using DELPHI ADOQuery query out later, can be directly ADOQuery. FiledByName (' image '). Asstring; The use base64 encoding can, if direct assignment to string is no good! Please comment, With this method ok? http://blog.csdn.net/easy007/article/details/1474347 CodePudding user response:
Use so complicated! A word is solved! DELPHI itself has a EncdDecd units, is for the base64 encoding/decoding. Probably the following: Var SSQL: string; SText: string; The begin SSQL:='the select Image field from the Table. ADOQuery. SQL. The Clear; ADOQuery. SQL. The Add (sSQL); ADOQuery. Open; If ADOQuery. Recordcount & gt; 0 then The begin SText:=EncodeString (ADOQuery FieldByName (' Image field). AsString) are identical);//this function is EncdDecd unit encryption function //here you can deposit the sText to TXT file, end; end; CodePudding user response:
No way! I also have to save to another database, and use as before! CodePudding user response:
function StreamToString (mStream: TStream) : string; Var I: Integer; The begin Result:='; If not Assigned (mStream) then the Exit; SetLength (Result, mStream. Size); For I=0 to Mr Pred (mStream. Size) do try MStream. Position:=I; MStream. Read (Result [Succ (I)], 1); Except, Result:='; end; end; CodePudding user response:
refer to the eighth floor xtarwgd response: not line! I also have to save to another database, and use as before! Can you put the string in base64 decoding stored in the database! This is the most commonly used method, a lot of online, search a handful CodePudding user response:
TBlobField (CDS, FieldByName (' imagefiled). SaveToFile (fileName); CodePudding user response:
clientdataset