Author: harrylynn | Posted on: 10/21/2009 9:13:09 PM | Views : 265

int intImageSize = this.PersonImage.PostedFile.ContentLength; String ImageType = this.PersonImage.PostedFile.ContentType; Stream imageStream = this.PersonImage.PostedFile.InputStream; Byte[] imageContent = new Byte[intImageSize]; int intStatus = imageStream.Read(imageContent, 0, intImageSize); SqlConnection connection = new SqlConnection("database=ImageTestingDatabase;server=localhost\\SQLEXPRESS;trusted_connection=true"); SqlCommand command = new SqlCommand(); try { connection.Open(); command.CommandText = "insert_image"; command.CommandType = CommandType.StoredProcedure; command.Connection = connection; command.Parameters.Add(new SqlParameter("@imageContent", imageContent)); command.Parameters.Add(new SqlParameter("@imageType", ImageType)); ...

Go to the complete details ...