后台判断格式是否想要的类型可使用 try{} catch{}捕获错误,
来源:互联网 发布:淘宝好评返现被投诉了 编辑:程序博客网 时间:2024/06/05 02:13
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
shipped_list rowupdat = new shipped_list();
string Ror_id = ((Label)this.GridView1.Rows[e.RowIndex].FindControl("ID_R")).Text.ToString();//
string Price = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Price")).Text.ToString();//
string Invoice_no = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Invoice_no")).Text.ToString();//
string Invoice_date = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("Invoice_date")).Text.ToString();
string TKUQ_PO = ((TextBox)this.GridView1.Rows[e.RowIndex].FindControl("TKUQ_PO")).Text.ToString();//
string PayDate = ((TextBox)this.GridView1.Rows[e.RowIndex].FindControl("PayDate")).Text.ToString();//
Hidden_num.Value = Price.ToString().Trim();
//ScriptManager.RegisterStartupScript(this, typeof(string), "js", "type_button2()", true);
if (Price == "")
{ Price = "0"; }
string type_1 = "RowUpdat";
float Price_s = 0;
try
{
Price_s = float.Parse(Price);
if (rowupdat.RowUpdat_se(Invoice_date, Price_s, Invoice_no, TKUQ_PO, PayDate, Ror_id, type_1, type_1))
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.alert('更新成功!'); </script>", false);
}
else
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.alert('更新失败!'); </script>", false);
}
}
catch
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.alert('更新失败!单价格式错误!'); </script>", false); ;
}
float Price_s = 0;
try
{
Price_s = float.Parse(Price); }
catch
{
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "alert", " <script>window.alert('更新失败!单价为数字类型错误!'); </script>", false); ;
}
- 后台判断格式是否想要的类型可使用 try{} catch{}捕获错误,
- 如何判断new的内存是否失败?使用try catch
- 异常捕获try catch的使用
- php try catch捕获错误
- 使用try/catch捕获异常
- 使用TRY/CATCH 格式
- SqlServer try catch 捕获不到的一些错误及解决方法
- SqlServer try catch 捕获不到的一些错误及解决方法
- 捕获异常的Try Catch
- 使用try catch判断是否输入为数字
- 使用try catch 捕获Soap 异常
- 使用try和catch捕获异常
- 使用try catch抛出和捕获异常
- 使用lua实现try-catch异常捕获
- 关于异常捕获 try catch的说明
- try catch 的使用
- try...catch的使用
- 在ios开发中使用 try 和 catch 来捕获错误。
- 最短路径问题 动态规划
- 得到自身的Html
- xml直接生成界面之折腾三
- ZC公司员工评分系统——后台查询合成DataTable
- 经典排序算法
- 后台判断格式是否想要的类型可使用 try{} catch{}捕获错误,
- 常用字符串长度计算函数
- 一个数以最少步骤分解为另外两个数和差问题的解决
- 就是一直往前走
- 局部变量、全局变量、静态局部变量、静态全局变量的异同
- C++常用函数
- 取石子问题
- Codeforce 1
- Android中Handler的线程间通讯原理