我正在设计一个表格,以在列表框中显示总费用。我发现
当我尝试运行此命令时出现错误
我的目的是显示courseID,numberOfStudent和总费用(“ operatingCost”列和“ materialFee”列的总和)
我想搜索两个值之间的TotalCost。(例如“ price1”文本框和“ price2”文本框的值)搜索例如700和1000之间的所有totalCost
但是运行命令后,消息框上显示错误
错误消息是关于
ErrorSystem.Date.OleDB.OleDbExceptionError(0x80040E14)选择查询运算符
sum(operatingCost + materialFee)> ='700'和d
OleDbCommand cmd = new OleDbCommand("select courseId ,numOfStudent,sum( operatingCost + materialFee) AS Total_Cost from course group by courseId , numOfStudent having sum(operatingCost + materialFee) >= '" + price1.Text + "' and =<'" + price2.Text + "'", connection);
我的问题在哪里?有人可以告诉我吗?
最佳答案
"... having sum(operatingCost + materialFee) between " + price1.Text + " and " + price2.Text, connection);
未报价