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

时间:2013-10-03 02:26:10

标签: 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中尝试了相同的查询,它获取了我需要的数据。不确定问题是什么,任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

试试这个:

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"

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