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
mujeesh
NA
1
0
Image location to MySql Database
Aug 2 2010 8:13 AM
hi
I am using Mysql database.
I am trying to insert an image location in to my database but its not saving properly.if i choose an image "E:\Production\Images\image001.jpg"
its saving like this "E:ProductionImagesimage001.jpg"
//this is my code
private void button2_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(open.FileName);
//I am using a class
c.cmd = new MySqlCommand("SELECT COUNT(*) FROM image_table;", c.conn());
maxVal = Convert.ToInt32(c.cmd.ExecuteScalar().ToString());
c.conn();
string query = "INSERT INTO image_table (IMAGE_NO, IMAGE_LOCATION, ASSIGN_DATE, ASSIGN_TO, ASSIGN_BY) VALUES ('" + (maxVal + 1) + "', '" + open.FileName+ "', '" + this.Assign_date.Value + "','" + Class1.AssignTo + "','" + Class1.userName + "')";
{
c.cmd = new MySqlCommand(query, c.conn());
//Execute command
c.cmd.ExecuteNonQuery();
c.conn().Close();
}
}
}
Please suggest a method to solve this problem.I am stuck,the code isn't work.
Thank u
Reply
Answers (
0
)
how to create a multi -user application.
sql select command where CustomerId LIKE textbox.text