绑定下拉列表的查询问题 [英] Query problem for binding dropdown

查看:125
本文介绍了绑定下拉列表的查询问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,您好,先生,我目前正在开展宿舍管理项目,当我从数据库的下拉列表中向学生分配仅vacent房间的空间时,我可以显示分配了多少空间,vacent是多少空间,我们如何可以做

hello sir currently i am working on hostel management project i want when i allot room to the sutdent only vacent room are show in dropdownlist from database and i can show how much room are alloted and how much are room are vacent ,how we can do

推荐答案

很简单,是的,只修复宿舍中的房间数,只是将bool变量作为该属性的基础,如果该属性为true,则将房间分配给其他人房间以主要形式空着,只是显示已分配的房间和空房间
just simple yeah fix the number rooms in hostel just bool variable as a base for that attribute and if the attribute is true the room is allocated other else the room is vacant in main form just show allocated and vacant rooms


只需在表中创建另一个名称为IsVacant且数据类型为int或bit的字段
指定是否分配了房间,然后指定IsVacant 1,否则为0
然后,您只需要在sql这样的代码中进行下拉

Just make another field in table having name IsVacant and having datatype int or bit
specify if room is alloted then the IsVacant 1 else it is 0
Then you have to just code in sql like that for dropdown

select * from TableName where IsVacant=0



此查询仅返回空房间列表..

您也可以使用group by子句进行计数
就是这样.. :)



this query returns list of vacant room only..

You can count also with group by clause
like that.. :)

select count(*) from TableName group by IsVacant



它可以为您分配空置房间的数量



It gives you count of alloted as well Vacant rooms


这篇关于绑定下拉列表的查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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