Dim r1 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim r2 As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
If r1.Value IsNot Nothing AndAlso r2.Value IsNot Nothing Then
Dim rq1 As Date = r1.Value
Dim rq2 As Date = r2.Value
For i As Integer = 0 To DataTables("疫苗程序").DataRows.Count - 1
DataTables("疫苗消耗").AddNew()
DataTables("疫苗消耗").DataRows(i)("猪只_类型") = DataTables("疫苗程序").DataRows(i)("猪只类型")
DataTables("疫苗消耗").DataRows(i)("疫苗_名称") = DataTables("疫苗程序").DataRows(i)("疫苗_名称")
If DataTables("疫苗程序").DataRows(i).IsNull("母猪_怀孕") = False Then
Dim a As Integer = DataTables("疫苗程序").DataRows(i)("母猪_怀孕")
Dim s As String = DataTables("疫苗程序").DataRows(i)("sys_user")
Dim mzhy As Integer
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "Select count(*) F rom {母猪分娩断奶信息} As a inner join (Select 编号, max(配种日期) As 配种日期 f rom {母猪分娩断奶信息} group by 编号 ) As b on a.编号 = b.编号 And a.配种日期 = b.配种日期 Where [sys_user]= s and [分娩_日期] is null and a.配种日期 BETWEEN DateAdd(d, -a, rp1) AND DateAdd(d, -a, rq2)"
mzhy = cmd.ExecuteScalar()
DataTables("疫苗消耗").DataRows(i)("猪只_数量") = mzhy
End If
Next
End If
我这个代码设置在“buttom”的click时间上,点击后就出现以下错误提示:可能是黄色语句哪里出错了,请老师帮我改一下
列名 'rq2' 无效。
列名 'a' 无效。
列名 'rp1' 无效。
列名 'a' 无效。
列名 's' 无效。