1.数据区
public static int updateDetailById(BackupDetail model)
{
StringBuilder sb = new StringBuilder();
sb.Append("UPDATE " + Setting.OWMER + "BACKUPDETAIL set WORKHUB=:workHub,JOBNUMBER=:jobNumber,BACKUPDESCRIPTION=:backupDescription,ORDERNO=:orderNo,FINISHTIME=:finishTime,ISWAIT=:isWait,MAERIALDESCRIPTION=:MaerialDescription,BUYTYPE=:buyType,CURRMARCH=:CurrMarch,DUTYMAN=:dutyMan,BUYPERSON=:buyPerson,BACKUPMAN=:backupMan,REMARK=:reMark where BACKUPID=:backupId");
OracleParameter[] par = {
new OracleParameter("workHub",model.WORKHUB ),
new OracleParameter("jobNumber",model.JOBNUMBER),
new OracleParameter("backupDescription",model.BACKUPDESCRIPTION),
new OracleParameter("isWait",model.ISWAIT),
new OracleParameter("MaerialDescription",model.MAERIALDESCRIPTION),
new OracleParameter("buyType",model.BUYTYPE),
new OracleParameter("CurrMarch",model.CURRMARCH),
new OracleParameter("dutyMan",model.DUTYMAN),
new OracleParameter("buyPerson",model.BUYPERSON),
new OracleParameter("backupMan",model.BACKUPMAN),
new OracleParameter("finishTime",model.FINISHTIME),
new OracleParameter("orderNo",model.ORDERNO),
new OracleParameter("reMark",model.REMARK),
new OracleParameter("backupId",model.BACKUPID)
};
try
{
return DbHelper.ExecuteNonQuery(sb.ToString(), par);
}
catch
{
throw;
}
}
2.修改后台区
3.页面部分修改区
<asp:Panel ID="plEdit" runat="server">
<tr>
<td style="width: 30px;">
<%#Container.ItemIndex+1 %>
</td>
<td style="display: none">
</td>
<td>
<asp:TextBox ID="txtWorkHub" Width="60px" Text='<%# DataBinder.Eval(Container.DataItem, "WORKHUB") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtJobNumber" Width="55px" Text='<%# DataBinder.Eval(Container.DataItem, "JOBNUMBER") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtBackupDescr" Width="120px" Text='<%# DataBinder.Eval(Container.DataItem,"BACKUPDESCRIPTION") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtIsWait" Width="30px" Text='<%# DataBinder.Eval(Container.DataItem,"ISWAIT") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtBuyType" Width="80px" Text='<%#DataBinder.Eval(Container.DataItem,"BUYTYPE") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtMaerialDescr" Width="110px" Text='<%# DataBinder.Eval(Container.DataItem,"MAERIALDESCRIPTION") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:DropDownList ID="ddlCurrMarch" Width="120px" runat="server" DataTextField='<%#DataBinder.Eval(Container.DataItem,"CURRMARCH") %>'>
</asp:DropDownList>
</td>
<td>
<asp:TextBox ID="txtOrderNo" Width="60px" Text='<%# DataBinder.Eval(Container.DataItem,"ORDERNO") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtFinishTime" Width="100px" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd '})"
Text='<%# DataBinder.Eval(Container.DataItem,"FINISHTIME") %>' runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtDutyMan" Width="90px" onclick="$.person.single($(this))" Text='<%# DataBinder.Eval(Container.DataItem,"DUTYMAN") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtBuyPerson" Width="90px" onclick="$.person.single($(this))" Text='<%# DataBinder.Eval(Container.DataItem,"BUYPERSON") %>'
runat="server"></asp:TextBox>
</td>
<td>
<asp:TextBox ID="txtBackupMan" Width="90px" onclick="$.person.single($(this))" Text='<%# DataBinder.Eval(Container.DataItem,"BACKUPMAN") %>'
runat="server"></asp:TextBox>
</td>
<td>
<img src="../Image/Green.jpg" runat="server" id="Img1" />
</td>
<td>
<img src="../Image/Red.jpg" runat="server" id="Img2" />
</td>
<td>
<asp:TextBox ID="txtReMark" Width="100px" Text='<%# DataBinder.Eval(Container.DataItem,"REMARK") %>'
runat="server"></asp:TextBox>
</td>
<td style="width: 90px">
<asp:LinkButton runat="server" Width="45px" ID="lbtUpdate" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "BACKUPID")%>'
CommandName="Update" Text="更新"></asp:LinkButton>
<asp:LinkButton runat="server" Width="45px" ID="lbtCancel" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "BACKUPID")%>'
CommandName="Cancel" Text="取消"></asp:LinkButton>
</td>
</tr>
</asp:Panel>
原因找到了,就是绑定的时间值在修改时为空的情况就会报错,我要怎么可以在时间为空时,修改别的数据也可以呢?求解!