boOperatorB
End Get
Set(value As String)
_cboOperatorB = value
End Set
End Property
Private _txtcontentB As String
Public Property txtcontentB() As String
Get
Return _txtcontentB
End Get
Set(value As String)
_txtcontentB = value
End Set
End Property
Private _cboRelationB As String
Public Property cboRelationB() As String
Get
Return _cboRelationB
End Get
Set(value As String)
_cboRelationB = value
End Set
End Property
Private _cboFieldC As String
Public Property cboFieldC() As String
Get
Return _cboFieldC
End Get
Set(value As String)
_cboFieldC = value
End Set
End Property
Private _cboOperatorC As String
Public Property cboOperatorC() As String
Get
Return _cboOperatorC
End Get
Set(value As String)
_cboOperatorC = value
End Set
End Property
Private _txtContentC As String
Public Property txtContentC() As String
Get
Return _txtContentC
End Get
Set(value As String)
_txtContentC = value
End Set
End Property
Private _tableName As String
Public Property tableName() As String
Get
Return _tableName
End Get
Set(value As String)
_tableName = value
End Set
End Property
End Class
D层如下:就学生上机状态查询来说:
'**********************************************
'文 件 名: T_LineDAL
'命名空间: DAL
'内 容:
'功 能:
'文件关系:
'作 者:丁国华
'小 组:宝贝计划
'生成日期: 2014/7/25 10:39:13
'版本号:V2.0
'修改日志:
'版权说明:
'**********************************************
'''
''' 组合查询-学生上机状态查看
'''
'''
'''
'''
Public Function queryStatus(enGroupQuery As Entity.GroupQueryEntity) As List(Of Entity.LineEntity) Implements ILine.queryStatus
Dim strText As String = "Proc_GroupQuery" '从存储过程里面查询相应信息
Dim cmdType As String = CommandType.StoredProcedure '命令类型
Dim parameter As SqlParameter() '传参
parameter = {New SqlParameter("@cboFieldA", enGroupQuery.cboFieldA),
New SqlParameter("@cboOperatorA", enGroupQuery.cboOperatorA),
New SqlParameter("@txtContentA", enGroupQuery.txtContentA),
New SqlParameter("@cboRelationA", enGroupQuery.cboRelationA),
New SqlParameter("@cboFieldB", enGroupQuery.cboFieldB),
New SqlParameter("@cboOperatorB", enGroupQuery.cboOperatorB),
New SqlParameter("@txtContentB", enGroupQuery.txtcontentB),
New SqlParameter("@cboRelationB", enGroupQuery.cboRelationB),
New SqlParameter("@cboFieldC", enGroupQuery.cboFieldC),
New SqlParameter("@cboOperatorC", enGroupQuery.cboOperatorC),
New SqlParameter("@txtContentC", enGroupQuery.txtContentC),
New SqlParameter("@tableName", enGroupQuery.tableName)}
Dim sqlHelper As New SqlHelper
Dim dt As New DataTable
Dim myList As List(Of Entity.LineEntity)
dt = sqlHelper.ExecuteReaderTable(strText, cmdType, parameter)
myList = EntityHelper.convertToList(Of Entity.LineEntity)(dt)
Return myList
End Function
End Class 对实体进行封装,把先前需要传递的十一个参数转换成现在只需要传递一个实体即可,还有一个细节问题需要注意的是,在存储过程里面SQL语句where后面的条件该如何写nie?就学生查看上机记录和操作员工作记录来说,第一个组合查询涉及到的状态有正常上机,正常下机,强制下机;第二个组合查询涉及到的状态有正在值班和下班两种状态,我们的第一个组合查询的业务需求是查出来的信息是状态不等于正常上机的相关信息,第二个组合查询的业务需求是状态不等于正在值班的相关信息,那么在where后面的条件到底是用and连接还是用or连接,小伙伴们都知道and的意思是和,连词,连接两个并列结构,or是或者的意思,整到这里,我就开始整蒙圈了,到底是用or还是用and呢?开始我的第一反应用的是or,要么执行这个,要么执行那个,别着急,让我们用实话说话,焦点访谈,呵呵,开个玩笑,在SQL中新建查询,看看用and连接,会发生什么好玩儿的事儿呢?
接着,用or连接:

进过对比,我们发现,第一个用and连接 |