asp.net - 查询表达式中的语法错误(缺少运算符) - ASP.NET

标签 asp.net sql syntax

使用以下查询出现语法错误:

strSQL = "SELECT Customer.customer_No, Customer.customer_Name,
                 Appointment.appointment_No,Appointment.appointment_Date, 
                 Appointment.start_Time, Appointment.end_Time 
          FROM Customer 
          INNER JOIN Vehicle 
               ON Customer.customer_No = Vehicle.customer_No   
          INNER JOIN Appointment 
               ON Vehicle.vehicle_Ref_No = Appointment.vehicle_Ref_No"

我在 SQL Server Management Studio 中尝试了相同的查询,它获取了我需要的数据。不确定问题是什么,任何帮助将不胜感激。

最佳答案

尝试这个 :

strSQL =@"SELECT Customer.customer_No, Customer.customer_Name,
                 Appointment.appointment_No,Appointment.appointment_Date, 
                 Appointment.start_Time, Appointment.end_Time 
          FROM Customer 
          INNER JOIN Vehicle 
               ON Customer.customer_No = Vehicle.customer_No   
          INNER JOIN Appointment 
               ON Vehicle.vehicle_Ref_No = Appointment.vehicle_Ref_No"

@ 将允许您编写多行并使用转义字符。

关于asp.net - 查询表达式中的语法错误(缺少运算符) - ASP.NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19149795/

相关文章:

.net - ASP.NET 的自定义文件扩展名 - 需要帮助!

ASP.NET 内容页面中的 jQuery id 选择

sql - 使用 ROW_NUMBER() OVER (PARTITION BY ...) 时出现问题

MySQL 查询与 Group by 以获得指定结果

php - MySQL大于日期返回小于给定日期的日期

azure - 从 Terraform 中的 map 列表中输出特定值

javascript - 使用 asp.net 表单进行 Bootstrap

asp.net - 我可以仅在 web.debug.config 中指定连接字符串吗?

javascript - D3JS 附加文本和鼠标行为不会出现

c - 在 C 中,在声明中使用 ":"运算符而不是条件运算符