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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
saurabh mittalPosted Mar 12, 2014, 9:09 AM
http://svgvijay.blogspot.in/2013/02/how-to-save-image-into-folder-in-c.html
jack esaiPosted Mar 12, 2014, 8:45 AM
saurabh mittalPosted Mar 12, 2014, 8:33 AM
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 esaiPosted Mar 12, 2014, 8:03 AM
saurabh mittalPosted Mar 12, 2014, 7:52 AM
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
Lakshmanan Sethu SankaranarayanPosted Mar 12, 2014, 7:47 AM
jack esaiPosted Mar 12, 2014, 7:05 AM
saurabh mittalPosted Mar 12, 2014, 6:55 AM
You can check this file for how to insert image and
design the gridview window form