这段代码有什么问题:
Private Sub Command1_Click() Dim Sell_tbl, Stock_Bottle, res As String Sell_tbl = "SELECT Sum((Quantity)*12) FROM Sell_Detail Where Cateogry='Large'" Stock_Bottle = "Select Sum(No_Of_Bottle) FROM Add_Bottle Where Cateogry='Large'" res = ((Sell_tbl) - (Stock_Bottle)) Adodc1.RecordSource = Sell_tbl Adodc1.Refresh Adodc1.Caption = Adodc1.RecordSource End Sub
我尝试将其结果转换为其他数据类型,但不起作用。谁能帮我?
这就是我想要的…
Private Sub Command2_Click() Dim con As New ADODB.Connection con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _ & App.Path & "\add_entry.mdb;Persist Security Info=False" Dim rs As New ADODB.Recordset Dim rs1 As New ADODB.Recordset Dim result_hold As Integer Dim large_tbl As String Dim sell_large As String large_tbl = "SELECT Sum(No_Of_Bottle) FROM add_cotton where Cateogry='Large'" sell_large = "SELECT Sum(Quantity) FROM Sell_Detail where Cateogry='Large'" rs.Open large_tbl, con, adOpenDynamic, adLockOptimistic rs1.Open sell_large, con, adOpenDynamic, adLockOptimistic result_hold = CInt(rs.Fields(0).Value) - CInt(rs1.Fields(0).Value) Text1.Text = CStr(result_hold) End Sub
‘如果您需要使整个柱子回退,请使用循环或其他方法。.但请记住,两个来源’永远不要使用单个网格…