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
Shubham Agrawal
1.5k
218
6.7k
how to update the data in asp.net using C#
Sep 19 2017 2:42 AM
i can't update data with tihs Code. So can Anyone suggest me as soon as possible.
string
CN = ConfigurationManager.ConnectionStrings[
"DBCS"
].ConnectionString;
using
(SqlConnection cn =
new
SqlConnection(CN))
{
cn.Open();
string
s =
"update Users set Username=@Username,Email=@Email,Password =@Password,City =@City,ContactNo =@ContactNo where ( Id =@Id)"
;
SqlCommand cmd =
new
SqlCommand(s, cn);
cmd.Parameters.AddWithValue(
"@Username"
, textbox1.Text);
cmd.Parameters.AddWithValue(
"@Email"
, textbox2.Text);
cmd.Parameters.AddWithValue(
"@Password"
, textbox3.Text);
cmd.Parameters.AddWithValue(
"@City"
, textbox4.Text);
cmd.Parameters.AddWithValue(
"@ContactNo"
, textbox5.Text);
cmd.Parameters.AddWithValue(
"@Id"
, textbox6.Text);
cmd.ExecuteNonQuery();
Response.Write(
"Your data SuccessFully Updated"
);
Reply
Answers (
4
)
Want to Make my Existing MVC4 website responsive.
Gridview Row Count Issue