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
satheesh babu
NA
128
312.2k
problem records insertion through asp.net
Nov 25 2008 3:19 AM
Hi all,
Here i am using checkbox list control and a button.In button click i wrote below code to insert values into a table in database.I write this code in loop because of I am using check box list control....
when i run my webform user can select single check box or multiple check boxes then when button click i want to insert those checked values into my table which has only one column
But when inserting from second record its showing below error....
The variable name '@counselor_name' has already been declared. Variable names must be unique within a query batch or stored procedure.
Here below is my code....
string st = "";
foreach (ListItem li in Chkcounselor.Items)
{
if (li.Selected)
{
st = li.Text.ToString();
SqlParameter counselorname = new SqlParameter("@counselor_name", SqlDbType.VarChar, 50);
counselorname.Value = st;
cmd.Parameters.Add(counselorname);
cmd.ExecuteNonQuery();
}
}
Please help me out....
thank you.
Reply
Answers (
2
)
drawing a rectangle
Unable to create Database Diagram