Picture of a fixed path (file) directly to the database?

xiaoxiao2021-03-06  150

System.IO.FileStream Fs = New System.IO.FileStream ("File Path and Name", IO.FILEMODE.Open, IO.FILEACCESS.READ;

Byte [] IMGData = new byte [fs.length];

fs.read (IMGDATA, 0, FS.LENGTH);

SqlConnection conn = new sqlconnection ("...");

SqlDataAdapter Da = New SqlDataAdapter ("SELECT ...", CONN);

DataSet DS = New Dataset ();

Da.fill (DS);

SQLCommandbuilder CB = New SQLCOMMAndBuilder (DA);

DS.Tables [0] .ROWS [0] ["IMG"] = IMGDATA;

Da.UPDATE (DS);

Where the IMG field is an Image type.

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

New Post(0)