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
Abdalla Elawad
NA
1k
213.8k
String or binary data would be truncated.
Jun 4 2016 3:42 AM
try
{
SqlCommand cmd = new SqlCommand("M_Update", Conn);
cmd.Parameters.Add("@CarNo", SqlDbType.Char).Value = (DropDownList1.SelectedValue);
cmd.Parameters.Add("@TeamNo", SqlDbType.BigInt).Value = TextBox1.Text.Trim();
cmd.Parameters.Add("@Customers", SqlDbType.NVarChar).Value = TextBox5.Text.Trim();
cmd.Parameters.Add("@DriverName", SqlDbType.NVarChar).Value = (DropDownList8.SelectedValue);
cmd.Parameters.Add("@First_Supervisor", SqlDbType.NVarChar).Value = (DropDownList9.SelectedValue);
cmd.Parameters.Add("@Second_Supervisor", SqlDbType.NVarChar).Value = (DropDownList10.SelectedValue);
cmd.Parameters.Add("@ServiceType", SqlDbType.NVarChar).Value = (DropDownList2.SelectedValue);
cmd.Parameters.Add("@BankName", SqlDbType.NVarChar).Value = (DropDownList3.SelectedValue);
cmd.Parameters.Add("@Region", SqlDbType.NVarChar).Value = (DropDownList4.SelectedValue);
cmd.Parameters.Add("@City", SqlDbType.NVarChar).Value = (DropDownList5.SelectedValue);
cmd.Parameters.Add("@PlanStartDate", SqlDbType.Date).Value = TextBox6.Text.Trim();
cmd.Parameters.Add("@Recycle_Date", SqlDbType.Date).Value = TextBox7.Text.Trim();
cmd.Parameters.Add("@Case_Option", SqlDbType.NVarChar).Value = (DropDownList6.SelectedValue);
cmd.Parameters.Add("@AbsenseName", SqlDbType.NVarChar).Value = (DropDownList7.SelectedValue);
cmd.Parameters.Add("@Responsible_1", SqlDbType.NVarChar).Value = TextBox14.Text.Trim();
cmd.Parameters.Add("@Responsible_2", SqlDbType.NVarChar).Value = TextBox15.Text.Trim();
cmd.Parameters.Add("@AlterSuper_1", SqlDbType.NVarChar).Value = TextBox12.Text.Trim();
cmd.Parameters.Add("@AlterSuper_2", SqlDbType.NVarChar).Value = TextBox13.Text.Trim();
cmd.Parameters.Add("@EmpAlterDate", SqlDbType.Date).Value = TextBox16.Text.Trim();
cmd.Parameters.Add("@NewRecycleDate", SqlDbType.Date).Value = TextBox17.Text.Trim();
cmd.Parameters.Add("@OperationDate", SqlDbType.Date).Value = TextBox6.Text.Trim();
cmd.CommandType = CommandType.StoredProcedure;
Conn.Open();
cmd.ExecuteNonQuery();
Conn.Close();
TextBox1.Text = "";
//TextBox2.Text = "";
//TextBox4.Text = "";
TextBox5.Text = "";
//TextBox3.Text = "";
TextBox6.Text = "";
TextBox7.Text = "";
TextBox12.Text = "";
TextBox13.Text = "";
TextBox14.Text = "";
TextBox15.Text = "";
TextBox16.Text = "";
TextBox17.Text = "";
Msglbl.Visible = true;
Msglbl.Text = "updated data";
}
catch
{
Msglbl.Text = " Not Update";
}
}
Reply
Answers (
3
)
why should i use escaping characters in connection string
read picture from database