we have stored Images as BLOB fields in mYSQl datbase.can anyone help us like how to display BLOB filed in ultrawingrid?Thank you.
Hi,
What kind of data is in your BLOB and what do you want to do with it? The grid doesn't have any built-in support for BLOBs, so you probably just have to convert your BLOB into some kind of DotNet object before the grid can do anything with it.
Images are stored in BLOB field. can anyone help me on how to display the image in Grid.Thank you.
Hello sweish,
I`m agree with Mike`s suggestion. Also as far as I know the equivalent of BLOB field (in MySQL) is VarBinary data type into MS SQL - please take a look at the attached screenshot and http://www.mssqltips.com/sqlservertutorial/2203/mysql-to-sql-server-data-type-comparisons/ . So I think that if you have an image in byte[] array format, you will be able to store this image into your MySQL database and also you will be able to represent the image back into our UltraGrid. To be sure that my assumption is correct, I created a small sample. In the sample I used MySql database with a column from BLOB data type. Also I convert my Bitmap and JPAG images into byte[] array format using the code below:
Bitmap bmp = new Bitmap(Resource1.Su_37);
ImageConverter converter = new ImageConverter();
ultraGrid1.ActiveRow.Cells["bimage"].SetValue(converter.ConvertTo(bmp, typeof(byte[])), false);
Please take a look at the attached video file for more details and if you have any questions, feel free to write us.
Regards
Thank you so much for the reply.
Image is stored in daatbase by the users. So there will not be any physical image file.
Without storing the image anywhere while retrieving, is there any way to convert the BLOB field into byte() array and display in grid.
Thank you.
Thanks a lot. it worked.
If you need any additional assistance don’t hesitate to ask.
sweish said:Image is stored in daatbase by the users
conn.Open(); using (Command cmd = new Command(sqlCommand, conn)) { using (IDataReader dataReader = cmd.ExecuteReader()) { while (dataReader.Read()) { byte[] byteArray= (Byte[])dataReader["BLOBField"]; }
ultraGrid1.ActiveRow.Cells["bimage"].SetValue(byteArray,false); } }
Also for me is interesting to know what is your approach to connect with database. Are you using TableAdapters, SQL commands and so on...? Did you set Style property of your column to be Image ?
sweish said: So there will not be any physical image file. Without storing the image anywhere while retrieving
If you have any questions, feel free to write me