Write image type data

xiaoxiao2021-03-06  45

In the field in the database, there is an Image type, but how can I pay this field, how is the size of this field? Please make a master. If you can, I hope to tell me how to use this field in Delphi.

-------------------------------------------------- -------------

Read and write in a stream.

Are you going to go wrong, here is the PB version?

-------------------------------------------------- -------------

STREAM.

-------------------------------------------------- -------------

Write from where you write it. What write it.

Below I write an ASP program I made. Hope it helps you

<% DIM RS

Dim Formsize, Formdata, Bncrlf, Divider, DataStart, DataEnd, MyData

Formsize = Request.totalbytes

Formdata = Request.binaryRead (Formsize)

Bncrlf = chrb (13) & chrb (10)

Divider = Leftb (Formdata, ClNG (INSTRB (FormData, Bncrlf) - 1)

DataStart = INSTRB (Formdata, Bncrlf & Bncrlf) 4

DataEnd = INSTRB (Datastart 1, Formdata, Divider) -DataStart

MyData = MIDB (FormData, Datast, DataEnd)

%> <%

SET RS = Server.createObject ("AdoDb.Recordset")

SQL = "SELECT * from Pic Where id =" & session ("id")

RS.Open SQL, CONN, 3, 3

IF r.eof then

SET RS = Nothing

SET RS = Server.createObject ("AdoDb.Recordset")

RS.Open "PIC", CONN, 3, 2

rs.addnew

RS ("ID") = session ("id")

RS ("BIG"). Appendchunk MyData

RS ("Date") = DATE

Rs.Update

SET RS = Nothing

Else

RS ("BIG"). Appendchunk MyData

RS ("Date") = DATE

Rs.Update

END IF

"The image is uploaded successfully, the display is as follows. Return Please press this

%>

-------------------------------------------------- -------------

I saw an old brother in the first two days, quite good (VB code). As follows

Dim mstream as adodo.stream

'Write

Set mstream = new adoDb.stream

MStream.Type = adtypebinarymstream.open

Mstream.LoadFromFile Picture file name

Rs.fields ("Field Name") .Value = mstream.read

Rs.Update

'read out

Set mstream = new adoDb.stream

MStream.Type = adtypebinary

MSTream.open

MStream.write Rs.fields ("Field Name") .value

MSTream.savetofile "C: /Publogo.gif", AdsavecreateOverWrite

-------------------------------------------------- -------------

Var sv: olevariant;

Save data to variable SV

Adoquery1.edit;

AdoQuery1.fieldbyName ('mfile'). SetData (@sv);

Adoquery1.post;

转载请注明原文地址:https://www.9cbs.com/read-54904.html

New Post(0)