我做了一个小程序,如下,就是用记录集执行select语句
数据库连接没有问题,可是运行时老是出现错误提示:“至少一个参数没有被指定值”
private Sub Form_Load()
dim bl1_select as string
dim string1 as string
dim cnn as ADODB.connection
dim rs1 as ADODB.Recordset
dim bl1_rs1 as integer
bl1_select = "1"
string1 = "select count(*) from T_RKDB where cldm like '" + "__" + bl1_select + "%" + "' And gysdm = CStr(txtgysdm.Text) And rq = CStr(Format(Date))"
Set cnn = New ADODB.Connection
Set rs1 = New ADODB.Recordset
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + App.Path + "\物资管理系统.mdb " + ";Persist Security Info=False"
cnn.Open
rs1.CursorLocation = adUseClient
rs1.Open string1, cnn, adOpenStatic, adLockOptimistic, adCmdText
bl1_rs1 = rs1.Fields(0)
msgbox bl1_rs1
end Sub
请问我错在哪,请高手指点一二 ,小弟先行谢过!
rq ,cldm ,gysdm 都是字段名
rq 是日期类型
cldm 和 gysdm 是文本类型
txtgysdm 是一个文本框的名称