是这样的,Candidate表中有人的Id和部门(CanId ,Appdepart),比如我传递参数cid为市场调查 ,要在Departments表内找对应的DepId 但是运行时就有错误
错误类型:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
列名 '市场调查' 无效。
/Mis/hr/admin/Canremove.asp, 第 30 行
还有我明明列名DepName 有的 表名也没错啊 这是什么情况?
cid = Request.QueryString("cid")
sql="select * from Candidate Where CanId=" & cid
set rs1 = Conn.Execute(sql)
Appdepart=rs1("Appdepart")
sql="select * from Departments where DepName = " & Appdepart
set rs3 = Conn.Execute(sql)
DepId= rs3("DepId")
是asp的页面问题
很明显,你sql语句有问题。sql="select * from Departments where DepName = " & Appdepart 。这里,你Appdepart接收到的是中文吧?需要用单引号括起来。
温馨提示:答案为网友推荐,仅供参考
第1个回答 2009-02-28
无论是否是中文,只要属性列是字符型的就要加单引号
第2个回答 2009-02-28
你在程序里传过去的参数是中文?
第3个回答 2009-02-28
加单引号