日期:2014-05-18  浏览次数:20426 次

未能找到带参数的非泛型方法
逻辑层方法如下:
  [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
  //public bool AddcalMainRecords(string? equipment_Name,int Use_Place_ID,DateTime Cal_Date,DateTime Due_Date,int Cal_Cycle_ID,string? Vender,string? Brand,string? Model,string? Serial_NO,string? Accuracy,string Class,int Project_ID,int Process_ID,string Status,string WI_NO,string? Drawing_NO,int? Renter_ID,DateTime? Rent_Date,int Sign_ID,string? Remark)
  public bool AddcalMainRecords(string equipment_Name, int Use_Place_ID, DateTime Cal_Date, DateTime Due_Date, int Cal_Cycle_ID, string Vender, string Brand, string Model, string Serial_NO, string Accuracy, string Class, int Project_ID, int Process_ID,string Status, string WI_NO, string Drawing_NO, int Renter_ID,DateTime Rent_Date,int Sign_ID,string Remark)

  {
  // 新建一个calMainRecordsRow实例
  cal.calMainRecordsDataTable mycals=new cal.calMainRecordsDataTable();
  cal.calMainRecordsRow mycal=mycals.NewcalMainRecordsRow();
  //mycal.Equipment_Name = equipment_Name;
  if (equipment_Name == null) mycal.SetEquipment_NameNull(); else mycal.Equipment_Name = equipment_Name;
  if (Vender == null) mycal.SetVenderNull(); else mycal.Vender = Vender;
  if (Brand == null) mycal.SetBrandNull(); else mycal.Brand = Brand;
  if (Model == null) mycal.SetModelNull(); else mycal.Equipment_Name = equipment_Name;
  if (Accuracy == null) mycal.SetAccuracyNull(); else mycal.Accuracy = Accuracy;
  if (Drawing_NO == null) mycal.SetDrawing_NONull(); else mycal.Drawing_NO = Drawing_NO;
  //少了Renter_ID和Rent_Date
  if (Remark == null) mycal.SetRemarkNull(); else mycal.Remark = Remark;
  mycals.AddcalMainRecordsRow(mycal);
  int rowsAffected = Adapter.Update(mycals);
  // 如果刚好新增了一条记录,则返回true,否则返回false
  return rowsAffected == 1;
  }
在表现层插入数据的时候,提示:“/WebSite2”应用程序中的服务器错误。
--------------------------------------------

ObjectDataSource“objGetDatas”未能找到带参数的非泛型方法“AddcalMainRecords”: Equipment_Name, Cal_Date, Due_Date, Vender, Brand, Model, Serial_NO, Accuracy, Class, Status, WI_NO, Drawing_NO, Remark, ID。 
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 

异常详细信息: System.InvalidOperationException: ObjectDataSource“objGetDatas”未能找到带参数的非泛型方法“AddcalMainRecords”: Equipment_Name, Cal_Date, Due_Date, Vender, Brand, Model, Serial_NO, Accuracy, Class, Status, WI_NO, Drawing_NO, Remark, ID。

源错误: 

执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  

堆栈跟踪: 


[InvalidOperationException: ObjectDataSource“objGetDatas”未能找到带参数的非泛型方法“AddcalMainRecords”: Equipment_Name, Cal_Date, Due_Date, Vender, Brand, Model, Serial_NO, Accuracy, Class, Status, WI_NO, Drawing_NO, Remark, ID。]
  System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters, DataSourceOperation operation) +1356919
  System.Web.UI.WebControls.ObjectDataSourceView.ExecuteInsert(IDictionary values) +852
  System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +89
  System.Web.UI.WebControls.DetailsView.HandleInsert(String commandArg, Boolean causesValidation) +379
  System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +574
  System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95
  System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
  System.Web.UI.WebCon