Using classic ASP to save an image into a sql server

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
Buzoianu AlexAsked:
Who is Participating?
 
MishaProgrammerCommented:
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

0
 
aranaCommented:
how you know what he did or what he didnt? I do not see any attached code or example of what he tried.
0
 
MishaProgrammerCommented:
There is no activity from author.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.