sql查询连接多个表 [英] sql queries to connect more than one table

查看:98
本文介绍了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查询连接多个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆