Public Function GetState2Refine(ByVal ddh As String, ByVal ddhh As String, ByVal wlbm As String, ByVal rjbb As String, ByVal lhbbh As String) As String
Dim cnStr As String = "Data Source=(local);Initial Catalog=songjiang;Integrated Security=False;User ID=sa;Password=bdcom103liujy;"
Dim cn As New SqlClient.SqlConnection(cnStr)
cn.Open()
Dim adapter As New SqlClient.SqlDataAdapter("sel ect * from [可用数量表] where 订单号 <> '" & ddh & "' and 订单行号 <> '" & ddhh & "' and 物料编码 = '" & wlbm & "' and 软件版本 = '" & rjbb & "' and 两化表编号 = '" & lhbbh & "'", cn)
Dim dt As New DataTable
adapter.Fill(dt)
cn.Close()
当输入的订单号和订单行号为空
"sel ect * from [可用数量表] where 物料编码 = '" & wlbm & "' and 软件版本 = '" & rjbb & "' and 两化表编号 = '" & lhbbh & "'"
当输入的订单号和订单行号都不为空时
"sel ect * from [可用数量表] where 订单号 <> '" & ddh & "' and 订单行号 <> '" & ddhh & "' and 物料编码 = '" & wlbm & "' and 软件版本 = '" & rjbb & "' and 两化表编号 = '" & lhbbh & "'"
在下面的语句怎么写才能满足上面2个条件。
Dim adapter As New SqlClient.SqlDataAdapter("sele ct * from [可用数量表] where 订单号 <> '" & ddh & "' and 订单行号 <> '" & ddhh & "' and 物料编码 = '" & wlbm & "' and 软件版本 = '" & rjbb & "' and 两化表编号 = '" & lhbbh & "'", cn)