我正在尝试写一个" if" asp中的语句以正确的格式获取数据,我需要在高图中提供。
问题1:你能告诉我我的if声明有什么问题吗? 问题2:如果我想添加另一个数据集以在条件0的另一个图表中提供,我如何在asp中引用它?我在哪里放置另一个sql语句?
condition = Split(Request.Form("condition"),"~")
'condition = Split("field1~field2~field3~('field4')~('')~('Field5')~'01/18/2015' and '02/02/2015'~field6", "~")
'0 is the chart type
'1 is chart frequency
'2 company
'3 is place
'4 is shop
'5 is caused
'6 is date range'
'7is top5 type'
'field7~('')~('')~('')~01/18/2015<>01/18/2015~field8'
'' Response.write condition(3)
chartinfo = condition(2)
dateString = ""
if condition(0)<>"Top 5" then
where = "[Type]='" + condition(1) +"'"
if condition(1)<> "Monthly" then
where = where + " and convert(datetime,date,101) between " + condition(6)
end if
if condition(3) <>"('')" then
where = where + " and place in " + condition(3)
chartinfo = chartinfo + ";" + condition(3)
end if
if condition(4) <>"('')" then
where = where + " and Shop in " + condition(4)
chartinfo = chartinfo + ";" + condition(4)
end if
if condition(5) <>"('')" then
where = where + " and [Caused Group] in " + condition(5)
chartinfo = chartinfo + ";" + condition(5)
end if
else
condition(0) = "Top 5" then
where
end if
where = replace(where,"'","''")
sql = "[Data] '" + where + "', '''" + dateString +"''','''"+ chartinfo +"'''"
答案 0 :(得分:0)
where = "[Type]='" + condition(1) +"'"
-->
where = " where [Type] = '" + condition(1) +"'"
..skip..
else
condition(0) = "Top 5" then
where
-->
else
' condition(0) = "Top 5" then
where = ""