Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

what are some characteristics of an array?

906


What is a custom attribute?

854


What are the 3 different types of arrays?

975


What is console write in c#?

893


Can properties be private in c#?

862


What is escape sequence in c#?

964


How does foreach loop work in c#?

916


Is it good to use var in c#?

816


What is a class in unity?

850


Is there a way of specifying which block or loop to break out of when working with nested loops?

963


How do I stop my console from closing in c#?

869


What is concrete class in c# with example?

914


What is the difference between interface and inheritance in c#?

872


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 m_addinProjects; public AllAddInProjects() { m_addinProjects = new SortedList(); } } }

2227


What is the difference between CONST and READONLY?

1016