How to store image file in Sql server database?
Answer Posted / y.s.a.naidu
MemoryStream ms = new MemoryStream();
pictureBox1.Image.Save(ms,
pictureBox1.Image.RawFormat);
byte[] img = ms.GetBuffer();
SqlCommand cmd = new SqlCommand("Insert into
tbl_Image(Images) values(@imgs)", cn);
SqlParameter p1 = new SqlParameter();
p1.ParameterName = "@imgs";
p1.SqlDbType = SqlDbType.Image;
p1.Value = img;
cmd.Parameters.Add(p1);
cn.Open();
cmd.ExecuteNonQuery();
MessageBox.Show("Image Inserted ....");
cn.Close();
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
what are some characteristics of an array?
What is a custom attribute?
What are the 3 different types of arrays?
What is console write in c#?
Can properties be private in c#?
What is escape sequence in c#?
How does foreach loop work in c#?
Is it good to use var in c#?
What is a class in unity?
Is there a way of specifying which block or loop to break out of when working with nested loops?
How do I stop my console from closing in c#?
What is concrete class in c# with example?
What is the difference between interface and inheritance in c#?
In a C# class we have a SortedList member m_addinProjects
we want to provide an iterator to allow the consumer of
this class access to the items in the collection. Please
provide an iterator method for the AnalyzeAddinsDLL class
below and an example of how it would be used.
namespace AnalyzeAddinsDLL
{
public class AllAddInProjects
{
private SortedList
What is the difference between CONST and READONLY?