How to insert and edit the gridview in C# not asp.net..
how to insert the image in database using mysql database and how to design the gridview in windows form..
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
saurabh mittal152 reputationPosted Mar 12, 2014, 2:55 AM EDT
You can check this file for how to insert image and
design the gridview window form
jack esai8 reputationPosted Mar 12, 2014, 3:05 AM EDT
Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted Mar 12, 2014, 3:47 AM EDT
saurabh mittal152 reputationPosted Mar 12, 2014, 3:52 AM EDT
I got ur Problem.than u can refer to these links.
it may be help u.
1.http://freakzmenia.blogspot.in/2010/10/image-saveretrieve-c-windows-form-sql.html
2.http://social.msdn.microsoft.com/Forums/windows/en-US/b6ae0182-619f-4c06-b0af-604a464a2738/how-to-add-image-from-database-to-the-windows-form?forum=winforms
3.http://www.codeproject.com/Questions/476578/insertplusimageplusinplusaccessplusdatabaseplususi
jack esai8 reputationPosted Mar 12, 2014, 4:03 AM EDT
saurabh mittal152 reputationPosted Mar 12, 2014, 4:33 AM EDT
FileStream fs;
string path = "C:\\Sunset.jpg";
fs = new FileStream(path, FileMode.Open, FileAccess.Read);
//a byte array to read the image
byte[] picbyte = new byte[fs.Length];
fs.Read(picbyte, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
10. Now below this create database connectivity and store this byte array(picbyte) to the image column in the database table you created in starting steps. OR you can use this code.
string cString = "Initial Catalog=DB NAME;Data Source=SQL SERVER INSTANCE;User ID=DB USER;Password=DB USER PASSWORD;";
SqlConnection connection = new SqlConnection(cString);
string query = "insert into TableName (ColumnName) values (@pic)";
connection.Open();
SqlParameter picparameter = new SqlParameter();
picparameter.SqlDbType = SqlDbType.Image;
picparameter.ParameterName = "pic";
picparameter.Value = picbyte;
SqlCommand cmd = new SqlCommand(query, connection);
cmd.Parameters.Add(picparameter);
if (cmd.ExecuteNonQuery() > 0)
MessageBox.Show("Image Saved");
connection.Close();
jack esai8 reputationPosted Mar 12, 2014, 4:45 AM EDT
saurabh mittal152 reputationPosted Mar 12, 2014, 5:09 AM EDT
http://svgvijay.blogspot.in/2013/02/how-to-save-image-into-folder-in-c.html