Using classic ASP to save an image into a sql server

Buzoianu Alex
Buzoianu Alex used Ask the Experts™
on
Hello,

The prolema that I encounter is related to classical programming.
I want to upload an image (jpeg, gif etc) into the sql server. We did not succeed with all our efforts. If you can help me, I will remain eternally grateful
All right,
Al.Buzoianu
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
You never uploaded the image contents to the database. That's just the file name.

In your application, you would upload this to the database following this format:

byte[] image = File.ReadAllBytes("D:\\11.jpg");

SqlCommand sqlCommand = new SqlCommand("INSERT INTO imageTest (pic_id, pic) VALUES (1, @Image)", yourConnectionReference);
sqlCommand.Parameters.AddWithValue("@Image", image);
sqlCommand.ExecuteNonQuery();

Open in new window

how you know what he did or what he didnt? I do not see any attached code or example of what he tried.

Commented:
There is no activity from author.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial