本文介绍了问题:第1行的“Modified_Date”列的数据被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DROP PROCEDURE IF EXISTS hms.UpdateCarePlan1;
CREATE PROCEDURE hms.`UpdateCarePlan1`(_Target_value int,
_Current_Test_Date Date,
_Test_Result varchar(50),
_Measurement_Frequency varchar(50),
_Next_Due_Date Date,
_Patient_Id int,
_ParameterId int,
_Modified_Date datetime,_date datetime)
BEGIN
UPDATE patient_progress_tracking_details c
INNER JOIN
patient_progress_tracking_header b
ON b.Id = c.Id
SET c.Target_Value = _Target_value,
c.Measurement_Frequency = _Measurement_Frequency,
c.Test_Result = _Test_Result,
c.Current_Test_Date = _Current_Test_Date,
c.Next_Due_Date = _Next_Due_Date,
c.Modified_Date = _Modified_Date,
b.Modified_Date=_date
WHERE c.Patient_Id = _Patient_Id AND c.ParameterId = _ParameterId;
END;
protected void grdcareplan_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string ParameterId = Convert.ToString(grdcareplan.DataKeys[e.RowIndex].Value);
TextBox txttargetvalue = (TextBox)grdcareplan.Rows[e.RowIndex].FindControl("txttargetvalue");
TextBox txttestdate = (TextBox)grdcareplan.Rows[e.RowIndex].FindControl("txttestdate");
TextBox txttestresult = (TextBox)grdcareplan.Rows[e.RowIndex].FindControl("txttestresult");
DropDownList ddlMeasurementFrequency = (DropDownList)grdcareplan.Rows[e.RowIndex].FindControl("ddlMeasurementFrequency");
TextBox txtnextduedate = (TextBox)grdcareplan.Rows[e.RowIndex].FindControl("txtnextduedate");
TextBox txtremarks = (TextBox)grdcareplan.Rows[e.RowIndex].FindControl("txtremarks");
DateTime testdt = DateTime.ParseExact(txttestdate.Text, "yy/dd/MM", null);
DateTime nextdate = DateTime.ParseExact(txtnextduedate.Text, "yy/dd/MM", null);
MySqlConnection strConnection = null;
MySqlCommand strCommand = null;
try
{
strConnection = new MySqlConnection();
strConnection.ConnectionString = StrConn;
strConnection.Open();
strCommand = new MySqlCommand();
strCommand.Connection = strConnection;
strCommand.CommandType = CommandType.StoredProcedure;
strCommand.CommandText = "UpdateCarePlan1";
strCommand.Parameters.AddWithValue("_Target_value", txttargetvalue.Text.ToString());
strCommand.Parameters.AddWithValue("_Current_Test_Date", testdt);
strCommand.Parameters.AddWithValue("_Test_Result", txttestresult.Text.ToString());
strCommand.Parameters.AddWithValue("_Measurement_Frequency", ddlMeasurementFrequency.SelectedItem.Text.ToString());
strCommand.Parameters.AddWithValue("_DiseaseId", ddlselectdisease.SelectedValue);
strCommand.Parameters.AddWithValue("_Next_Due_Date", nextdate);
strCommand.Parameters.AddWithValue("_ParameterId", ParameterId);
strCommand.Parameters.AddWithValue("_Patient_Id", Convert.ToInt32(Session["DiagnosisClickId"]));
strCommand.Parameters.AddWithValue("_Modified_Date", DateTime.Now);
strCommand.Parameters.AddWithValue("_date", DateTime.Now);
strCommand.ExecuteNonQuery();
grdcareplan.EditIndex = -1;
BindCarePlan();
ModalPopupExtender1.Show();
Biomade.Visible = true;
}
当我运行我的代码时,在更新时,有一个例外截断列''Modified_Date的数据''在第1行
。
请帮助我。
When I am running my code, at the time of updating, there is exception that Data truncated for column ''Modified_Date'' at row1
.
Please help me.
推荐答案
这篇关于问题:第1行的“Modified_Date”列的数据被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!