VB 文本框中显示 SQL 计算结果 急 在线等~!!
代码如下?PrivateSubCommand1_Click()Dimrs_dingdanchaxunAsNewADODB.RecordsetDimsqlAsStrings...
代码如下?
Private Sub Command1_Click()
Dim rs_dingdanchaxun As New ADODB.Recordset
Dim sql As String
sql = "select sum(货价) from 订货表 where ( 订货日期 between #" & DTPicker1.Value & "# and #" & DTPicker1.Value & "# ) group by 订货日期"
'rs_dingdanchaxun.CursorLocation = adUseClient
'rs_dingdanchaxun.Open sql, conn, adOpenKeyset, adLockPessimistic
'rs_dingdanchaxun.Close
'sql=select sum(货价) from table
'sql = "select * from 订货表 where 订货日期 between #" & DTPicker1.Value & "# and #" & DTPicker1.Value & "#"
rs_dingdanchaxun.CursorLocation = adUseClient
rs_dingdanchaxun.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Set DataGrid1.DataSource = rs_dingdanchaxun
'rs_dingdanchaxun.Close
End Sub
通过上面可以计算出总价,但是我现在想在datagrid 中显示该日期区间的内容,想将计算的总价显示到文本框中.
请问上面的代码怎么改~
用一楼的朋友的方法试了
提示:
参数类型不正确,或不在可以接受的范围之内,或与其它参数有冲突 展开
Private Sub Command1_Click()
Dim rs_dingdanchaxun As New ADODB.Recordset
Dim sql As String
sql = "select sum(货价) from 订货表 where ( 订货日期 between #" & DTPicker1.Value & "# and #" & DTPicker1.Value & "# ) group by 订货日期"
'rs_dingdanchaxun.CursorLocation = adUseClient
'rs_dingdanchaxun.Open sql, conn, adOpenKeyset, adLockPessimistic
'rs_dingdanchaxun.Close
'sql=select sum(货价) from table
'sql = "select * from 订货表 where 订货日期 between #" & DTPicker1.Value & "# and #" & DTPicker1.Value & "#"
rs_dingdanchaxun.CursorLocation = adUseClient
rs_dingdanchaxun.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Set DataGrid1.DataSource = rs_dingdanchaxun
'rs_dingdanchaxun.Close
End Sub
通过上面可以计算出总价,但是我现在想在datagrid 中显示该日期区间的内容,想将计算的总价显示到文本框中.
请问上面的代码怎么改~
用一楼的朋友的方法试了
提示:
参数类型不正确,或不在可以接受的范围之内,或与其它参数有冲突 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询