datagridview 显示的数据是四表连接查询的 怎样绑定第三个表中的数据

.Net技术 码拜 8年前 (2016-02-28) 958次浏览
if exists (select * from sysobjects where name=”usp_GuestRecordAllInfo”)
drop proc usp_GuestRecordAllInfo
go
create proc usp_GuestRecordAllInfo
as
select GuestName,IdentityID,ResideDate,Deposit,ResideName,LeaveDate,rr.RoomId,TypeID
from dbo.GuestRecord g
inner join dbo.ResideState  r on g.ResideID=r.ResideId
inner join dbo.Room rr on rr.RoomId=g.RoomId
inner join dbo.RoomType t on t.TypeId=rr.RoomTypeId
go
datagridview 显示的数据是四表连接查询的 怎样绑定第三个表中的数据
这个里面的TypeId 怎么能绑定到数据上面去?
解决方案

5

数据源只有一个

15

引用 5 楼 nj_xxcxy 的回复:
Quote: 引用 2 楼 qqamoon 的回复:

虽然有4个表,但查询出来的结果只有一个啊
还有,图片上不是已经有 typeid 了吗

有是有了 但是就是在显示的时候不能显示出来

你试试用 LEFT OUT JOIN,并且加载 rr 表的 RoomTypeId 和 r 表的其他某个字段,看看能否 JOIN 上了
left outer join dbo.RoomType t on rr.RoomTypeId = t.TypeId


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明datagridview 显示的数据是四表连接查询的 怎样绑定第三个表中的数据
喜欢 (0)
[1034331897@qq.com]
分享 (0)