hello there!
how do i get the sum in datagrid e.g in cell(2) values are:
600
700
200
total=1500
adodc1.recordsource ="select * from mytable where id_no=2"
then i will pass sum in the label1.caption = total in datagrid.cell(8)
tnx a lot
Printable View
hello there!
how do i get the sum in datagrid e.g in cell(2) values are:
600
700
200
total=1500
adodc1.recordsource ="select * from mytable where id_no=2"
then i will pass sum in the label1.caption = total in datagrid.cell(8)
tnx a lot
Learn how to use non databound ADo objects. Once you've set up the connection object (for sample its named conn) to get the sum...
Code:Dim rs As ADODB.Recordset
On Error Goto ErrHandler
Set rs = conn.Execute("SELECT SUM(field_to_sum) AS mysum FROM mytable WHERE id_no=2")
label1.Caption = rs.Fields("mysum").Value