Невозможно привести объект типа " system.object[]" к типу " crmwcfservices.invreqclass []"."}
---------Это передняя часть ----
ошибка //
Unable to cast object of type 'System.Object[]' to type 'CRMWCFSERVICES.InvReqClass[]'."}
Dim listReq As New List(Of InventoryRequest)
Для каждой из строк datarow в ДС.Таблицы(0).Строки
InvReq.REQUESTNUMBER = txtReqRefNo.Text
Инврек.Имя_проекта = cmbProg.Текст
Инврек.PARTNUMBER = строка("PartNo").Метод toString()
InvReq.EnggName = txtUserID.Text
Инврек.DEPTID = сессия("DeptID")
Инврек.ITEMID = строка("ItemId").Метод toString
InvReq.Кол-во = txtRQty.Текст
listReq.Add(InvReq)
-изобретатель.SendrequestToSL(InvReq.REQUESTNUMBER, InvReq.Имя проекта, InvReq.PARTNUMBER, InvReq.EnggName, InvReq.DEPTID, InvReq.Itemid и InvReq.Кол-во)
Следующий
Dim arrList как новая система.Коллекции.Коллекции(listReq)
// ошибка появляется в последней строке
invClient.SendrequestToSL(arrList.Метод toArray())
--------------wcf servives ----------
public string SendrequestToSL(List<InvReqClass> ListInvReqClass) { if (ListInvReqClass.Count == 0) { throw new ArgumentNullException("ListRequisitionRequest"); } var xmlElements = new XElement("ListRequisitionRequest", from RequisitionRequest in ListInvReqClass select new XElement("RequisitionRequest", new XAttribute("ReqNoteNumber", RequisitionRequest.ReqNoteNumber), new XElement("Qty", RequisitionRequest.Qty), new XElement("ProgramName", RequisitionRequest.ProgramName), new XElement("PartNo", RequisitionRequest.PartNo), new XElement("ItemId", RequisitionRequest.ItemId), new XElement("EnggName", RequisitionRequest.EnggName), new XElement("DeptId", RequisitionRequest.DeptID) )); return xmlElements.ToString(); } What I have tried: <pre>---------This is front end part ---- Dim listReq As New List(Of InventoryRequest) For Each Row As DataRow In ds.Tables(0).Rows InvReq.REQUESTNUMBER = txtReqRefNo.Text InvReq.PROJECTNAME = cmbProg.Text InvReq.PARTNUMBER = Row("PartNo").ToString() InvReq.EnggName = txtUserID.Text InvReq.DEPTID = Session("DeptID") InvReq.ITEMID = Row("ItemId").ToString InvReq.QTY = txtRQty.Text listReq.Add(InvReq) 'invClient.SendrequestToSL(InvReq.REQUESTNUMBER, InvReq.PROJECTNAME, InvReq.PARTNUMBER, InvReq.EnggName, InvReq.DEPTID, InvReq.ITEMID, InvReq.QTY) Next Dim arrList As New System.Collections.ArrayList(listReq) // error is coming in last line invClient.SendrequestToSL(arrList.ToArray()) --------------wcf servives ---------- <pre> public string SendrequestToSL(List<InvReqClass> ListInvReqClass) { if (ListInvReqClass.Count == 0) { throw new ArgumentNullException("ListRequisitionRequest"); } var xmlElements = new XElement("ListRequisitionRequest", from RequisitionRequest in ListInvReqClass select new XElement("RequisitionRequest", new XAttribute("ReqNoteNumber", RequisitionRequest.ReqNoteNumber), new XElement("Qty", RequisitionRequest.Qty), new XElement("ProgramName", RequisitionRequest.ProgramName), new XElement("PartNo", RequisitionRequest.PartNo), new XElement("ItemId", RequisitionRequest.ItemId), new XElement("EnggName", RequisitionRequest.EnggName), new XElement("DeptId", RequisitionRequest.DeptID) )); return xmlElements.ToString(); }
F-ES Sitecore
На какой линии происходит ошибка?
Member 10194266
в приведенном ниже коде
invClient.SendrequestToSL(arrList.Метод toArray())