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
checkbox gridview insert mysql
Sep 30 2015 6:44 AM
I know how to upload and insert using FileUpload ToolBox control.
But these time I have to insert selected gridView item(an image) to mysql using asp.net.
My codes are given below.
How can I fix it?
Examples will be much appriciated.
protected void ImageInsert()
{
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("INSERT INTO Images(Image) VALUES ('"+CheckBox().ToString()+"')", con);
con.Open();
int s1 = cmd.ExecuteNonQuery();
if (s1 > 0)
{
imgUp1.Text = "Image Uploaded succesfully!";
}
con.Close();
}
}
private string CheckBox()
{
string url=null;
foreach (GridViewRow row in gvImages.Rows)
{
CheckBox chkBox = row.FindControl("chkRow") as CheckBox;
if (chkBox !=null && chkBox.Checked)
{
Image img = (Image)row.Cells[1].Controls[1];
url = img.ImageUrl;
}
}
return url;
}
Reply
Answers (
5
)
How to call method that handles the Click event for several
Invalid value for key 'attachdbfilename'