日期:2014-05-17  浏览次数:20384 次

GridView修改
//修改物流单
  public static bool Modify(registerinfomodel register)
  {
  string sql = "update registerinfo set log_ship_unit=@log_ship_unit,log_doc_date=@log_doc_date,log_delivery_date=@log_delivery_date,log_customers=@log_customers,log_user=@log_user,log_logistics_order=@log_logistics_order,log_outbound_number=@log_outbound_number,log_state=@log_state,log_insurance=@log_insurance,log_transport_unit=@log_transport_unit,log_transport_order=@log_transport_order,log_cost=@log_cost,log_settlement_way=@log_settlement_way,log_ship_people=@log_ship_people,log_expected_arrive=@log_expected_arrive,log_served_time=@log_served_time,log_track_cond_one=@log_track_cond_one,log_track_cond_two=@log_track_cond_two where log_id=@log_id";
  Dictionary<string, object> dic = new Dictionary<string, object>();
  dic.Add("@log_ship_unit",register.Log_ship_unit);
  dic.Add("@log_doc_date",register.Log_doc_date);
  dic.Add("@log_delivery_date",register.Log_delivery_date);
  dic.Add("@log_customers",register.Log_customers);
  dic.Add("@log_user",register.Log_user);
  dic.Add("@log_logistics_order",register.Log_logistics_order);
  dic.Add("@log_outbound_number",register.Log_outbound_number);
  dic.Add("@log_state",register.Log_state);
  dic.Add("@log_insurance",register.Log_insurance);
  dic.Add("@log_transport_unit",register.Log_transport_unit);
  dic.Add("@log_transport_order",register.Log_transport_order);
  dic.Add("@log_cost",register.Log_cost);
  dic.Add("@log_settlement_way",register.Log_settlement_way);
  dic.Add("@log_ship_people",register.Log_ship_people);
  dic.Add("@log_expected_arrive",register.Log_expected_arrive);
  dic.Add("@log_served_time",register.Log_served_time);
  dic.Add("@log_track_cond_one",register.Log_track_cond_one);
  dic.Add("@log_track_cond_two",register.Log_track_cond_two);
  dic.Add("@log_id", register.Log_id);
  return DBHelper.ExecuteNonQueryTwo(sql, dic) > 0 ? true : false;
  }

public static int ExecuteNonQueryTwo(string sql, Dictionary<string, object> para)
  {
  int result = 0;
  using (SqlConnection conn = new SqlConnection(DBHelper.connString))
  {
  conn.Open();
  SqlCommand cmd = new SqlCommand(sql, conn);
  foreach (KeyValuePair<string, object> p in para)
  {
  cmd.Parameters.Add(GetParamater(p.Key, p.Value, cmd));
  }
  result = cmd.ExecuteNonQuery();
   
  return result;
  }
  }

大家帮我看看这两个方法写的对么,我是为了实现GridView写的

------解决方案--------------------
return DBHelper.ExecuteNonQueryTwo(sql, dic) > 0 ? true : false;
=======
直接这样就行了
 return DBHelper.ExecuteNonQueryTwo(sql, dic) > 0 ;


对不对,行不行,直接自己把代码跑一遍就行了