问题描述
有三个表Markmarkid|recorderID|tatalScore131910232030RecordertestID|recorderID|userID5319aa6320bbTesttestID|testName5数学6英语我的Repeater中的查询本来是SELECTPlace=(SELECTCOUNT(DISTINCTtotalScore)FROMMarkWHEREa.totalScore>=a.totalScore),b.userID,a.totalScoreFROMMarkASaINNERJOINRecorderASbONa.recorderID=b.recorderIDORDERBYPlaceDropDownLis中是数学,英语之类的集合当我想更新Repeater时,将查询改为SELECTPlace=(SELECTCOUNT(DISTINCTtotalScore)FROMMarkWHEREa.totalScore>=a.totalScore),b.userID,a.totalScoreFROMMarkASaINNERJOINRecorderASbONa.recorderID=b.recorderIDwhereb.testID=(selecttestIDfromT_TestwheretestName="+DropDownList1.SelectedValue+")ORDERBYPlace为什么无法查询出来?
解决方案
解决方案二:
你没有print一下你的拼接之后的sql看看么..DropDownList1.SelectedValue可能是id,而不是名称..,你直接试试b.test_id=DropDownList1.SelectedValue
解决方案三:
我觉得问题不在SELECTPlace=(SELECTCOUNT(DISTINCTtotalScore)FROMMarkWHEREa.totalScore>=a.totalScore),b.userID,a.totalScoreFROMMarkASaINNERJOINRecorderASbONa.recorderID=b.recorderIDwhereb.testID=(selecttestIDfromT_TestwheretestName="+DropDownList1.SelectedValue+")ORDERBYPlace因为我直接将他改为英语他都提示错误:列名无效