Syntax error (missing statement) in the query expression - ASP.NET

Getting a syntax error with the following query:

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"

I tried the same query in SQL Server Management Studio and it retrieves the data I need. Not sure what the problem is, any help would be appreciated.

+4
source share
1 answer

try the following:

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"

@ will allow you to write multiple lines and use escape characters.

0
source

All Articles