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
Joma Rajab
NA
110
51.8k
How to make multiple checkbox add to database
Aug 11 2016 10:53 AM
I need to add more one selected item from checkbox to database but when I select more one I could not for one Item it works fine
this the code
please help
thanks
cmd.CommandText =
"If Not Exists(select * from dbo.ModuleRelation where UId=@UId and MId=@MId) Begin insert into dbo.ModuleRelation (UId, MId, MName) values(@UId, @MId, @MName) End"
;
cmd.Connection = conn;
foreach
(ListItem item
in
chkModules.Items)
if
(item.Selected ==
true
)
{
conn.Open();
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue(
"@UId"
, DropDownList1.SelectedItem.ToString());
cmd.Parameters.AddWithValue(
"@MId"
, item.Value.ToString());
cmd.Parameters.AddWithValue(
"@MName"
, item.Text.ToString());
chkModules.Visible =
false
;
cmd.ExecuteNonQuery();
Reply
Answers (
5
)
How to Store CheckBox Checked and Unchecked in Hidden Field
secure web api example