作者TonyQ (骨头)
看板Web_Design
标题Re: [问题] asp网页一直出现"索引或主索引键不可包 …
时间Sun Apr 20 22:32:54 2008
※ 引述《chunhuian (水蓝)》之铭言:
: Set conn = Server.CreateObject("ADODB.Connection")
: conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.Mappath("db.mdb")
: conn.open
: sql = "select * from applydata where id='"&id&"' or s_id ='"&s_id&"'"
你的id跟s_id是什麽栏位?.?
正常状况下如果是「自动编号」,会是数字栏位喔...
(数字栏位的话,前後不用加单引号。)
另外,写sql如果是正式用途,要小心一下sql injection,
最好把id跟s_id做一下sql escape
(至少把id s_id 变数字串中可能的单引号换成两个单引号)
: set rs = Server.CreateObject("ADODB.Recordset")
: rs.open sql, conn, 1,3
: If name=empty or tel=empty or pws=empty or id=empty or s_id=empty then
: Response.Write "资料不完整,请返回上页重新输入!"
: Elseif Not rs.EOF Then ' 重覆id和s_id
: Response.Write "使用者名称或身份证字号重覆,请返回上页重新输入!"
: else
: response.redirect "view.asp"
: End If
: Response.End
: %>
--
I am a person, and I am always thinking .
Thinking in love , Thinking in life ,
Thinking in why , Thinking in worth.
I can't believe any of what ,
I am just thinking then thinking ,
but worst of all , most of mine is thinking not actioning...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68