Dim connection As OleDbConnection Dim adapter As OleDbDataAdapter Dim ds As New DataSet Dim SQLStr As String Dim cmd As OleDbCommand connection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=consignacion.mdb;") SQLStr = "SELECT sum(total) FROM salesdb WHERE buydate=@buydate GROUP BY buyer" cmd = New OleDbCommand(SQLStr, connection) cmd.Parameters.AddWithValue("@buydate", Form1.Lbldate2.Text) Try connection.Open() adapter = New OleDbDataAdapter(cmd) adapter.Fill(ds) connection.Close() DataGridView1.DataSource = ds.Tables(0) Catch ex As Exception MsgBox(ex.ToString) End Try
Quote:>data< Buyer total GIAN 100.00 BANAL 5,000.00 BANAL 2,200.00 JUN CASH 12,321.00 >output< buyer total newcolumnautoadded 100.00 7,200.00 12,321.00 wanted output GIAN 100.00 BANAL 7,200.00 JUN CASH< 12,321.00 just made it work via searching and learning please help me here. i want to display the names too.
Quote:SQLStr = "SELECT buyer,sum(total) FROM salesdb WHERE buydate=@buydate GROUP BY buyer"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)