Dim sb1 As System.Text.StringBuilder = New System.Text.StringBuilder("")
        Dim sb2 As System.Text.StringBuilder = New System.Text.StringBuilder("")
        Dim sb3 As System.Text.StringBuilder = New System.Text.StringBuilder("")
        sb1.Append(str1)
        sb1.Append("-")
        sb1.Append(str2)
        sb1.Append("-1")
        If (str1.ToString() = "") Or (str2.ToString() = "") Then
            MessageBox.Show("请输入日期")
            Return
        Else
            If str2 = "12" Then
                Dim s1 As Integer = Integer.Parse(str1.ToString()) + 1
                sb2.Append(s1)
                sb2.Append("-1-1")
            Else
                Dim s2 As Integer = Integer.Parse(str2.ToString()) + 1
                sb2.Append(str1)
                sb2.Append("-")
                sb2.Append(s2)
                sb2.Append("-1")
            End If
        End If
        sb3.Append(str1)
        sb3.Append(str2)
        For i As Integer = 0 To iRowsCount - 1
            Dim type1 As String = dt1.Rows(i)(0).ToString()
            Try
                Dim str As String = "select sum(sep_current_cost) from product_instore where sep_current_date < ' "+ sb1 + "' and sep_pro_id='" + type1 + "'"
                Dim sdaout As SqlCommand = New SqlCommand(str, conStr1)
其中Dim str As String = "select sum(sep_current_cost) from product_instore where sep_current_date < ' "+ sb1 + "' and sep_pro_id='" + type1 + "'"
这里出错了 错误提示是:运算符"+"不是为类型"string"和"system.Text.stringBuilder"定义的
但是在C#中这样写是没有错误的请问这是什么原因啊。。应该怎么解决。。
求教各位高手。请帮小弟解决下哦。。先谢谢啦

解决方案 »

  1.   

    "select sum(sep_current_cost) from product_instore where sep_current_date < '"& sb1  &"' and sep_pro_id='" & type1 & "'"
      

  2.   

    在VB里面连接字符串用+和&是一样的..这样改了还是有错误.不是根本原因.呵呵.不过还是谢谢了:)
      

  3.   

    Dim str As String = "select sum(sep_current_cost) from product_instore where sep_current_date < ' " + sb1.ToString + "' and sep_pro_id='" + type1 + "'"