TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Carlos Sanchez
NA
264
0
Uploading Image File to a DataBase
Jul 19 2004 3:34 PM
Somebody know how to upload a Image File to a DataBase. The file is selceted by the user by a OpenFileDialog. if (OpenFileDialog1.Show()==DialogResult.Ok) { Image img = Image.FromFile(OpenFileDialog1.FileName) //Uploading img to the DataBase } I have the next wrong code to Upload img to the DataBase: SqlCommand InsertCommand = new SqlCommand("INSERT TO MyTable (ImageColumn) VALUES (@Image)",MyConnacetion); InsertCommand.Parameters.Add("@Image",img); //This line throws an error MyConnection.Open(); InsertCommand.ExecutQuery(); MyConnection.Close(); When I add the paremeter, the next exception is thrown: "Index (zero based) must be greater than or equal to zero and less than the size of the argument list." Any Idea? Thanx in advance.
Reply
Answers (
1
)
tree view with links
Command Pattern