0
我收到以下錯誤給我的ASP登錄ASP錯誤沒有爲一個或多個必需參數
Microsoft JET Database Engine error '80040e10' No value given for one or more required parameters. /vdateUsr.asp, line 47
的數據的形式被輸入並在Access數據庫檢查值。這裏是代碼:
' variables
dim cnStr
dim rcSet
dim frmUsername
dim frmPassword
dim sqlStr
dim strSQL
'store form input into variables
frmUsername = Request.Form("username")
frmPassword = Request.Form("password")
'create connection and recordset objects
Set cnStr = Server.CreateObject("ADODB.Connection")
Set rcSet = Server.CreateObject("ADODB.Recordset")
' defining database connection (connectionstring.asp)
cnStr.ConnectionString = path
cnStr.Provider = provider
cnStr.open
' execute sql and open as recordset
sqlStr = "Select * From users where [User Name] = ('" & frmUsername & "') and [Password] = ('" + frmPassword + "')"
strSQL="SELECT startup site FROM users WHERE [User Name] = ('" & frmUsername & "') and [Password] = ('" & frmPassword & "')"
' Opens the returned values from the SQL as a recordset, ready for iteration by ASP
'Line 47 below
set rcSet = cnStr.Execute(sqlStr)
任何幫助,將不勝感激。
在此先感謝
在第47行讀取'response.write(sqlSTR)'和第二行'response.end'之前添加一行。然後看看輸出的SQL ...看起來像frmusername和frmpassword有價值嗎?另外...認真研究使用參數化查詢。這有SQL注入問題,導致網站黑客入侵。這裏是如何:http://stackoverflow.com/questions/770419/how-to-make-a-parametrized-sql-query-on-classic-asp – xQbert 2014-08-28 17:41:40
也會[推薦這個](http://stackoverflow.com/ a/21698468/692942)詳細解釋了一些可以反覆使用的技巧。 – Lankymart 2014-08-28 18:19:21