对于以下linq查询,我添加了
w = document.tblTransmittalls.Select(dx => dx.tblFiles)
字段以及下面的函数我添加了“theDocument.w”参数,但我有错误,它显示了我:
IEnumerable<System.Data.Linq.EntitySet<tblFile>>
虽然我喜欢和其他论点一样:IEnumerable<tblFile> w
我不知道发生了什么。
编译器错误消息:CS1502
在将“theDocument.w”参数添加到我的函数之前,我没有错误。
private void DisplayDocument()
{
var documents =
from document in _DataContext.tblDocuments
where document.DocId == _DocID
select new
{
DocId = document.DocId,
Title = document.TITLE,
DocNo = document.DocumentNo,
Originator = document.Originator,
Type = document.Document_Type,
Unit = document.Unit,
MaterialCode = document.EQ_IN_Identify_Material_Code,
Transmittals = document.tblTransmittalls.Select(dt => dt.tbltransmittalNo),
x = document.tblTransmittalls.Select(dp => dp.tblDocTranstoCons.tblTranstoCon),
//Authors = book.BookAuthors.Select(bookAuthor => bookAuthor.AuthorObject),
y = document.tblTransmittalls,
z = document.tblTransmittalls.Select(dp => dp.tblDocTranstoCons),
w = document.tblTransmittalls.Select(dx => dx.tblFiles)
}
DisplayTransmittals(theDocument.Transmittals, theDocument.x, theDocument.DocId, theDocument.y, theDocument.z, theDocument.w);
private void DisplayTransmittals(IEnumerable<tbltransmittalNo> transmittals, IEnumerable<tblTranstoCon> x, int d,
IEnumerable<tblTransmittall> y, IEnumerable<tblDocTranstoCon> z, IEnumerable<tblFile> w)
{
Transmittallistfortest transmittalList = (Transmittallistfortest)DetailsView1.FindControl("Transmittallistfortest1");
GridView g3 = transmittalList.FindControl("GridViewTtransmittals") as GridView;
transmittalList.Transmittals = transmittals;
transmittalList.Doc = d;
transmittalList.Transmittaltocons = x;
transmittalList.DocTranstoCons = z;
transmittalList.tblTransmittall = y;
transmittalList.Efiles = w;
transmittalList.DataBind();
}
答案 0 :(得分:0)
在Google上搜索错误代码会返回this page,表示这是The best overloaded method match for 'declaration' has some invalid arguments
错误的代码。
基于此以及添加导致错误的theDocument.w
的结果,听起来theDocument.w
不属于IEnumerable<tblFile>
类型。