<WebMethod()>
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=172.16.11.201;Initial Catalog=songjiang;Integrated Security=False;User ID=sa;Password=bdcom103liujy;"
Dim cn As New SqlClient.SqlConnection(cnStr)
cn.Open()
Dim adapter As SqlClient.SqlDataAdapter
Dim strSql As String = ""
If ddh = "" Or ddhh = "" Or ddh = "null" Or ddhh = "null" Then
Dim state1 As String
state1 = "订单号或者订单行号不能为空"
Return state1
'adapter = New SqlClient.SqlDataAdapter("s elect * from [可用数量表] where 物料编码 = '" & wlbm & "' and 软件版本 = '" & rjbb & "' and 两化表编号 like '% " & lhbbh & "%'", cn)
Else
Dim filter As String = "1=1"
If wlbm = "" Then
filter &= " and 1=1"
ElseIf wlbm = "null" Then
filter &= " and 物料编码 is null"
Else
filter &= " and 物料编码 = '" & wlbm & "'"
End If
If lhbbh = "" Then
filter &= " and 1=1"
ElseIf lhbbh = "null" Then
filter &= " and 两化表编号 is null"
Else
filter &= " and 两化表编号 like '%" & lhbbh & "%'"
End If
If rjbb = "" Then
filter &= " and 1=1"
ElseIf rjbb = "null" Then
filter &= " and 软件版本 is null"
Else
filter &= " and 软件版本 = '" & rjbb & "'"
End If
Dim filter1 As String = "订单号 is null or 订单行号 is null or 订单号 <> '" & ddh & "' or 订单行号 <> '" & ddhh & "' and "
MsgBox(filter1)
此主题相关图片如下:filter1.png
strSql = "s elect * from [可用数量表] where " & filter1 & filter
MsgBox(strSql)
此主题相关图片如下:strsql.png
adapter = New SqlClient.SqlDataAdapter(strSql, cn)
Dim dt As New DataTable
adapter.Fill(dt)
cn.Close()
报下面的错误参数“Expression”不是有效值。这不是合成s elect不对?
System.ArgumentException: 参数“Expression”不是有效值。
在 Microsoft.VisualBasic.Strings.Format(Object Expression, String Style)
在 WebApplication4.OrderQueryBLL.GetWareRootWork(DataRow dr1) 位置 F:\VS\WebApplicationN\WebApplication4\OrderQueryBLL.vb:行号 51
在 WebApplication4.OrderQueryBLL.ConvertToJsonObject(DataTable dataTable) 位置 F:\VS\WebApplicationN\WebApplication4\OrderQueryBLL.vb:行号 31
在 WebApplication4.WebService1.GetState2Refine(String ddh, String ddhh, String wlbm, String rjbb, String lhbbh) 位置 F:\VS\WebApplicationN\WebApplication4\WebService1.asmx.vb:行号 167