using (WcfDataEntities DbContext = new WcfDataEntities())
{
var listFields = from a in DbContext.ObjectList
join b in DbContext.FieldList
on a.AutoID equals b.ParentRowID
where a.ObjectName == strTableName && a.ObjectType == "T"
orderby b.Sort
select new MessageInfo
{
AutoID = b.AutoID,
FieldName = b.FieldName + '|' + b.DataType,
FieldNameCh = b.FieldNameCh
};
var listMessage = listFields.ToList<MessageInfo>();
strJsonData = JsonConvert.SerializeObject(listMessage);
}
FieldName = b.FieldName + '|' + b.DataType 我想这样多列合为一列,,但是报错:索引(从零开始)必须大于或等于零,且小于参数列表的大小。这个要咋写????
------解决思路----------------------
using (WcfDataEntities DbContext = new WcfDataEntities())
{
var listFields = from a in DbContext.ObjectList
join b in DbContext.FieldList.AsEnumerable()
on a.AutoID equals b.ParentRowID
where a.ObjectName == strTableName && a.ObjectType == "T"
orderby b.Sort
select new MessageInfo
{
AutoID = b.AutoID,
FieldName = b.FieldName + "
------解决思路----------------------
" + b.DataType,
FieldNameCh = b.FieldNameCh
};
var listMessage = listFields.ToList<MessageInfo>();
strJsonData = JsonConvert.SerializeObject(listMessage);
}
------解决思路----------------------
string.Format()?
把单引号改成双引号?
------解决思路----------------------
FieldName = b.FieldName + "
------解决思路----------------------
" + b.DataType,