473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

retrieve blob picture from mysql database c#

1
I use this code to retrieve my picture and it work corectly with a simple table that contain only blob but when i'm trying to adapt it for my table user that containt (cin,nom,prenom....,image) exception that indicate

"Paramétre non valid" (not a valid parameter)
Expand|Select|Wrap|Line Numbers
  1.         int bufferSize = 1000; 
  2.         try
  3.         {
  4.             string SQL = "Select image from user ";
  5.  
  6.             MySqlCommand cmd = new MySqlCommand(SQL, db.Connection);
  7.             MySqlDataAdapter da = new MySqlDataAdapter(cmd);
  8.             DataSet ds = new DataSet();
  9.             da.Fill(ds, "image");
  10.             int c = ds.Tables["image"].Rows.Count;
  11.             db.CloseConnection();
  12.  
  13.             if (c > 0)
  14.             {
  15.                 Byte[] byteBLOBData = new Byte[bufferSize];
  16.                 byteBLOBData = (Byte[])(ds.Tables["image"].Rows[c - 1]["image"]);
  17.                 MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
  18.  
  19.                 pictureBox1.Image = Image.FromStream(stmBLOBData);
  20.                 MessageBox.Show("bien chargée");
  21.             }
  22.  
  23.         }
  24.         catch (Exception ex)
  25.         {
  26.             MessageBox.Show("Connection Error!\n" + ex.Message, "Error Message",
  27.                     MessageBoxButtons.OK, MessageBoxIcon.Error);
  28.         }
Feb 29 '16 #1
1 8318
madankarmukta
308 256MB
May I please know at which line it is giving an error ?
Mar 26 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: webmechanic | last post by:
I was able to insert images into mysql stored as binary data. How do I retrieve it. Please provide thorough explanation. Thanks.
2
by: Waqas.L.Khan | last post by:
Hi Guys, I'm doing some work with richtextboxes and want to be able to save and load the content from them to a mysql database (including all formatting). I figured the best way to do this would...
1
by: viresh | last post by:
Hello everybody, I am quite beginner as a software professional in php & mysql. I want to know how I can fetch data from mysql database to show in a form's drop down box with php...
2
by: sarah aziz | last post by:
Hello all I am trying to retrieve the data from mysql database by php to plot a flot graph can anyone help me please this is all i have done for now Php $sql = mysql_query("SELECT count(Msg_ID)...
0
by: Kim Charlene | last post by:
Hi, guys! I've created a java servlet where I can upload video with limited size. The video uploaded is being saved in the mySQL database as BLOB. How can I retrieve that BLOB and display it as the...
3
by: nehpets | last post by:
this is the code that i tried to make but its not working..nothing happen to the output..i need some help..please..i am a beginner in c#....thanks!!! private void button1_Click(object sender,...
3
by: ossama louiss | last post by:
hi evryone i want to know how to convert a blob to string i tried some solution but it keeps show the result like this .
3
by: Ruchi choudhary | last post by:
Hello, What I want to do is I would like to populate dropdown menus with options from the database (e.g. file no, I would like to populate). The code seems to currently show a dropdown menu...
0
by: impin | last post by:
i have table cresults. email marks last_submit pooja23@gmail.com 9 2013-05-24 rajletsgetlost@gmail.com 5 2013-05-24 romancingtherain@gmail.com 5 2013-05-24 vidhya.vs@gmail.com 8 2013-05-24
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.