谢谢各位的帮助!在大家的提示下,特别是islet, 我的高级查询系统已经做好了
我把主要的sql语句写出来,但愿对和我有类似问题的朋友有所帮助!
select case strxuewei
case "全部"
strsql="select * from xwlwtj where 1=1"
case "硕士"
strsql="select * from xwlwtj where Xuewei='硕士'"
case "博士"
strsql="select * from xwlwtj where Xuewei='博士'"
case else
strsql="select * from xwlwtj where 1=1"
end select
if strtext1<>"" then
select case strhigh1
case "论文题名"
strsql=strsql&"And (Chntitle like '%"&strtext1&"%' "
case "论文作者"
strsql=strsql&"And Name='"&strtext1&"' "
case "导师"
strsql=strsql&"And Teachername1='"&strtext1&"'"
case "学科专业"
strsql=strsql&"And Major like '%"&strtext1&"%'"
case "关键词"
strsql=strsql&"and Keyword like '%"&strtext1&"%'"
case "中文摘要"
strsql=strsql&"and AbstructCH like '%"&strtext1&"%'"
case "提交年份"
strsql=strsql&"and Datetime like '%"&strtext1&"%'"
'case "分类号"
'strsql=strsql& "and Datetime like '%"&strtext1&"%'"
'case "全文"
'strsql=strsql& "and Datetime like '%"&strtext1&"%'"
end select
end if
if strtext2<>"" then
If strhigh2<>"not" then
select case strhigh3
case "论文题名"
strsql=strsql& ""&strhigh2&" Chntitle like '%"&strtext2&"%'"
case "论文作者"
strsql=strsql& ""&strhigh2&" Name='"&strtext2&"'"
case "导师"
strsql=strsql& ""&strhigh2&" Teachername1='"&strtext2&"'"
case "学科专业"
strsql=strsql& ""&strhigh2&" Major like '%"&strtext2&"%'"
case "关键词"
strsql=strsql& ""&strhigh2&" Keyword like '%"&strtext2&"%'"
case "中文摘要"
strsql=strsql& ""&strhigh2&" AbstructCH like '%"&strtext2&"%'"
case "提交年份"
strsql=strsql& ""&strhigh2&" Datetime like '%"&strtext2&"%'"
case "分类号"
strsql=strsql& ""&strhigh2&" Datetime like '%"&strtext2&"%'"
case "全文"
strsql=strsql& ""&strhigh2&" Datetime like '%"&strtext2&"%'"
end select
else
select case strhigh3
case "论文题名"
strsql=strsql& "and Chntitle not like '%"&strtext2&"%'"
case "论文作者"
strsql=strsql& "and Name!='"&strtext2&"'"
case "导师"
strsql=strsql& "and Teachername1!='"&strtext2&"'"
case "学科专业"
strsql=strsql& "and Major not like '%"&strtext2&"%'"
case "关键词"
strsql=strsql& "and Keyword not like '%"&strtext2&"%'"
case "中文摘要"
strsql=strsql& "and AbstructCH not like '%"&strtext2&"%'"
case "提交年份"
strsql=strsql& "and Datetime not like '%"&strtext2&"%'"
case "分类号"
strsql=strsql& "and Datetime not like '%"&strtext2&"%'"
case "全文"
strsql=strsql& "and Datetime not like '%"&strtext2&"%'"
end select
end if
end if
if strtext3<>"" then
if strhigh4<>"not" then
select case strhigh5
case "论文题名"
strsql=strsql& ""&strhigh4&" Chntitle like '%"&strtext3&"%'"
case "论文作者"
strsql=strsql& ""&strhigh4&" Name='"&strtext3&"'"
case "导师"
strsql=strsql& ""&strhigh4&" Teachername1='"&strtext3&"'"
case "学科专业"
strsql=strsql& ""&strhigh4&" Major like '%"&strtext3&"%'"
case "关键词"
strsql=strsql& ""&strhigh4&" Keyword like '%"&strtext3&"%'"
case "中文摘要"
strsql=strsql& ""&strhigh4&" AbstructCH like '%"&strtext3&"%'"
case "提交年份"
strsql=strsql& ""&strhigh4&" Datetime like '%"&strtext3&"%'"
case "分类号"
strsql=strsql& ""&strhigh4&" Datetime like '%"&strtext3&"%'"
case "全文"
strsql=strsql& ""&strhigh4&" Datetime like '%"&strtext3&"%'"
end select
else
select case strhigh5
case "论文题名"
strsql=strsql& "and Chntitle not like '%"&strtext3&"%'"
case "论文作者"
strsql=strsql& "and Name!='"&strtext3&"'"
case "导师"
strsql=strsql& "and Teachername1!='"&strtext3&"'"
case "学科专业"
strsql=strsql& "and Major not like '%"&strtext3&"%'"
case "关键词"
strsql=strsql& "and Keyword not like '%"&strtext3&"%'"
case "中文摘要"
strsql=strsql& "and AbstructCH not like '%"&strtext3&"%'"
case "提交年份"
strsql=strsql& "and Datetime not like '%"&strtext3&"%'"
case "分类号"
strsql=strsql& "and Datetime notlike '%"&strtext3&"%'"
case "全文"
strsql=strsql& "and Datetime not like '%"&strtext3&"%'"
end select
end if
end if