您好我正在使用MSSQL,MS VS 2013,C#创建一个Web服务,到目前为止一切进展顺利
c_array[10]
作为简单SQL查询运行时的查询执行正常但在代码中结果为
List<Company_Invoices> customers = new List<Company_Invoices>();
var json = "";
var result = dc.ExecuteQuery<Company_Invoices>(@"SELECT top 10
sih.[No_],
sih.[External Document No_],
sih.[Due Date],
sih.[Order Date],
sih.[Posting Date],
sih.[Shipment Date],
cus.[Id] as 'Sell To Customer Id',
cust.[Id] as 'Bill To Customer Id',
sih.[Currency Code],
sih.[Salesperson Code],
sih.[Location Code],
cle.[Open],
cle.[Sales (LCY)],
(SELECT SUM([Amount (LCY)]) AS Expr1
FROM dbo.[Company$Detailed Cust_ Ledg_ Entry] AS d
WHERE ([Cust_ Ledger Entry No_] = cle.[Entry No_])
AND ([Entry Type] = 1) AND ([Posting Date] = cle.[Posting Date]))
as 'Sum Amount LCY',
(SELECT SUM([Amount (LCY)]) AS Expr1
FROM dbo.[Company$Detailed Cust_ Ledg_ Entry] AS dcle
WHERE ([Cust_ Ledger Entry No_] = cle.[Entry No_])) as 'Sum Amount LCY2'
FROM dbo.[Company$Sales Invoice Header] AS sih
LEFT OUTER JOIN dbo.[Company$Cust_ Ledger Entry] AS cle
ON cle.[Document No_] = sih.No_
AND cle.[Document Type] = 2
LEFT OUTER JOIN dbo.[Company$Customer] AS cus
ON sih.[Sell-to Customer No_] = cus.[No_]
LEFT OUTER JOIN dbo.[Company$Customer] AS cust
ON sih.[Bill-to Customer No_] = cust.[No_]");
customers = result.ToList<Company_Invoices>();
json = jss.Serialize(customers);
return json;
有什么问题?问,因为我做了几个类似的查询,他们工作得很好,但这个并没有太大的不同。