本文介绍了sql查询连接多个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个存储过程,在这里我想从多个表中检索信息.我创建了它,如果显示给我看,它可以工作.但是,当我运行它以获取表中的数据时,它返回空
I have created a stored procedure where i want to retrieve information out of multiple tables. i have created it and if shows me that ot works. But when i run it to get the data in the tables it returns empty
推荐答案
ALTER PROCEDURE [dbo].[procGetSingleAppointmentDate]
@Date nvarchar(20)
AS
SELECT AppointmentType.AppointmentType,AppointmentSlots.AvailabilityTimes,Patient.PatName
FROM AppointmentType,AppointmentSlots,Patient,Employee
WHERE AppointmentType.TypeID=AppointmentSlots.TypeID AND AppointmentSlots.PatientID=Patient.PatientID AND Employee.EmpRecNumber = AppointmentSlots.EmpRecNumber
AND AppointmentSlots.Date = @Date;
ALTER PROCEDURE [dbo].[procGetSingleAppointmentDate]
\\the code to send date
<pre lang="cs">protected void btnSearch_Click1(object sender, EventArgs e)
{
bl = new BusinessLayer();
DataTable appointment = new DataTable();
appointment = bl.GetSpecificAppointment (DatePicker.SelectedDate.ToShortDateString());
gdvSingleAppointment.DataSource = appointment;
gdvSingleAppointment.DataBind();
}
这篇关于sql查询连接多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!