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
Dhruvi kukadiya
NA
20
11.3k
Error converting data type nvarchar to int.
Dec 30 2014 3:04 AM
I gote exception "Error converting data type nvarchar to int." on cmd.ExecuteNonQuery();
when I run following code.
{
con.Open();
{
string OLdpassword = txtOldPassword.Text;
if (OLdpassword == txtOldPassword.Text)
{
if (txtNewPassword.Text == txtConfirmPassword.Text)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "UpdatePassword";
cmd.Parameters.AddWithValue("@user_id",Convert.ToString(Session["user_id"]));
cmd.Parameters.AddWithValue("@user_password", txtOldPassword.Text);
cmd.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
lblmsg.Text = "Password updated successfully";
}
else
{
lblmsg.Text = "Execution error";
}
}
else
{
lblmsg.Text = "Password miss match";
}
}
else
{
lblmsg.Text = "Old password is incorrect";
}
}
con.Close();
clear();
}
catch (Exception ex)
{
}
Reply
Answers (
4
)
MODEL , POCO and OOPS CLASS Difference ?
Send mail different pdf file attached at a time Asp.net C#