if Instr(session("glid"),",")<>0 then
sql="select A.ArticleID,A.ClassID,C.ClassName,A.Title,A.PostTime,A.UpdateTime,A.EditAuthor,A.Hits,A.TitColor,A.Author from [Elook_Article] A inner join [Elook_Class] C on A.ClassID=C.ClassID where"
for i=1 to UBound(split(cstr(session("glid")),","))
sql="sql & A.IsDel=0 and A.ClassID="&split(cstr(session("glid")),",")(i)&" or"
next
sql="sql & A.IsDel=0 and A.ClassID="&split(cstr(session("glid")),",")(0)&" order by articleid Desc"
Set rs=Server.CreateObject("ADODB.Recordset")
Rs.open sql,conn,1,1,&h0001
glid里有未知个数用","隔开的数字,我想把这些数字放到一个SQL语句中,并且他们是并列关系,如上,运行提示错误:
错误类型:
Microsoft JET Database Engine (0x80040E14)
无效的 SQL语句;期待 'DELETE'、'INSERT'、'PROCEDURE'、'SELECT'、或 'UPDATE'。
/cl/Admin_Article.asp, 第 423 行
请大家帮忙看看问题出在哪,这种方法应该是可以的吧?
把split用在数据库连接语句中的问题。急!