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
abdujalil chuliev
1.3k
400
41k
insert selected image from datagrid in wpf
Oct 17 2015 11:54 AM
There is a DataGrid with bunch of images in my wpf application.
I have to select an image from my DataGrid and insert that image to mysql DB.
My code is not working properly.
I need help. My code is below.
private void btnImage_Click(object sender, RoutedEventArgs e)
{
{
string constr = "Data Source=localhost;port=3306;Initial Catalog=MyCollege;User Id=root;password=2525";
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("INSERT INTO images(Image) VALUES ('" + dataGrid1.SelectedValue + "')", con);
con.Open();
int s1 = cmd.ExecuteNonQuery();
if (s1 > 0)
{
lbl1.Content = "Image inserted succesfully";
}
con.Close();
}
}
Reply
Answers (
0
)
datetime textbox as null
how to add confirmation in if statement