【问题标题】:Ms-access Syntax error (missing operator) in query expression '(Quantity * UnitPrice) ExtendedPrice'查询表达式 '(Quantity * UnitPrice) ExtendedPrice' 中的 Ms-access 语法错误(缺少运算符)
【发布时间】:2018-01-19 09:14:30
【问题描述】:
OleDbConn.ole = "SELECT ProductCode, Description, Quantity, UnitPrice, (Quantity * UnitPrice) ExtendedPrice FROM SalesReturnItem sri INNER JOIN Product p ON p.ProductNo = sri.ProductID WHERE Sri.InvoiceNo = " 
+ invoiceNo + " ORDER BY Description ";

每当我执行此查询时,我都会收到以下错误 -

查询表达式 '(Quantity * UnitPrice) ExtendedPrice'。

请帮忙

【问题讨论】:

  • 单独展示 SQL 查询。
  • 它在下面解决了问题

标签: c# sql ms-access


【解决方案1】:

使用 AS - SQL 别名用于为表或表中的列提供临时名称。

OleDbConn.ole = "SELECT ProductCode, Description, Quantity, UnitPrice, (Quantity * UnitPrice) AS ExtendedPrice FROM SalesReturnItem sri INNER JOIN Product p ON p.ProductNo = sri.ProductID WHERE Sri.InvoiceNo = " 
+ invoiceNo + " ORDER BY Description ";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2019-07-18
    • 2012-06-06
    • 1970-01-01
    相关资源
    最近更新 更多