我想使用此查询填充 dataGridView1,此查询返回正确的结果,但它在 c#.net 代码中引发错误。
string sql = "SELECT bill_no, name_shop, SUM(qty * price) as [Total],dt FROM purchase_stock_entry INNER JOIN purchase_party_name ON purchase_stock_entry.purchase_party_id = purchase_party_name.id GROUP BY bill_no, name_shop;";
DataSet ds = new DataSet();
OleDbCommand cmd = new OleDbCommand(sql, con);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
**Error : You tried to execute a query that does not include the
specified expression 'total' as part of an aggregate function.**