以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  窗口  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74698)

--  作者:阿福
--  发布时间:2015/9/16 22:34:00
--  窗口
Dim ncb1 As WinForm.NumericComboBox = Forms("月报表").Controls("NumericComboBox1")
Dim ncb2 As WinForm.NumericComboBox = Forms("月报表").Controls("NumericComboBox2")
Dim n1 As Integer = ncb1.Value
Dim n2 As Integer = ncb2.Value

Dim cmd1 As new SQLCommand
cmd1.C
cmd1.CommandText = " select count(*) f rom {母猪分娩断奶信息} where [sys_user]=\'" & user.Name & "\' and year(分娩_日期)= n1 and month(分娩_日期)= n2 "
Dim i1 As Integer = cmd1.ExecuteScalar
Dim fen1 As WinForm.TextBox = Forms("月报表").Controls("分1")
fen1.Value = i1

错误提示:
.NET Framework 版本:2.0.50727.8000
Foxtable 版本:2014.11.11.1
错误所在事件:
详细错误信息:
列名 \'n2\' 无效。
列名 \'n1\' 无效。

请求老师,解救一下!

--  作者:大红袍
--  发布时间:2015/9/16 22:39:00
--  
cmd1.CommandText = " select count(*) f rom {母猪分娩断奶信息} where [sys_user]=\'" & user.Name & "\' and year(分娩_日期)= " & n1 & " and month(分娩_日期)= " & n2