我相信我的 INSERT 语句有问题。当我运行我的代码时,错误消息显示:
行:5
错误:Sys.WebForms.PageRequestManagerServerErrorException:“,”附近的语法不正确。
我的 where 子句有问题吗?
这是我的INSERT
声明:
INSERT into AppointmentDetails (SelectedApptDate, SelectedApptStartTime,
SelectedApptEndTime, SelectedWeddingPlanner)
SELECT
ApptID
from
Appointment
INNER JOIN
Appointment ON Appointment.ApptID = AppointmentDetails.ApptID
WHERE
SelectedApptDate = @SelectedApptDate,
SelectedApptStartTime = @SelectedApptStartTime,
SelectedApptEndTime = @SelectedApptEndTime,
SelectedWeddingPlanner = @SelectedWeddingPlanner
这就是我从 C# 中调用它的方式:
command.CommandText = "INSERT into AppointmentDetails (SelectedApptDate, SelectedApptStartTime, SelectedApptEndTime, SelectedWeddingPlanner) SELECT ApptID from Appointment INNER JOIN Appointment ON Appointment.ApptID = AppointmentDetails.ApptID WHERE SelectedApptDate = @SelectedApptDate, SelectedApptStartTime = @SelectedApptStartTime, SelectedApptEndTime = @SelectedApptEndTime, SelectedWeddingPlanner = @SelectedWeddingPlanner";
command.Connection = connection;
command.Parameters.AddWithValue("@SelectedApptDate", dateSelected);
command.Parameters.AddWithValue("@SelectedApptStartTime", timeStart);
command.Parameters.AddWithValue("@SelectedApptEndTime", timeEnd);
command.Parameters.AddWithValue("@SelectedWeddingPlanner", weddingplanner);