c# - BLOB Data retrieval in table form -
mysqlconnection con= new mysqlconnection("server=localhost;database=databasename;user=username;password=password"); string query="select *from table"; using (mysqldataadapter adpt= new mysqldataadapter(query,con)) { dataset dset= new dataset(); adpt.fill(dset); mytabledatagridview.datasource=dset.tables[0]; } con.close
the following code can retrieve data of varchar , int, don't retrieve blob kind of data ....plzz give solution blob can read method or other method downloadable file mode
the blob data should read database byte array. should it:
filestream fs = new filestream(filepath, filemode.open, fileaccess.read); binaryreader br = new binaryreader(fs); byte[] photo = br.readbytes((int)fs.length); br.close(); fs.close();
i took code here: https://www.akadia.com/services/dotnet_read_write_blob.html. note load blob memory stream instead of filestream if wanted display blob on screen e.g. if photo.
Comments
Post a Comment