No value given for one or more required parameters.
อันนี้ file dbconnect.asp ครับ
<%
Dim conn
Function ConnectDB()
set conn = Server.CreateObject("ADODB.Connection")
conn.Open"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../db/mt.mdb")
If Err.Number = 0 Then
ConnectDB = True
Else
ConnectDB = False
End If
End Function
%>
อันนี้ไฟล์ ที่ ขึ้น ERROR ดังกล่าว
<%
Dim fname, lname, email, user, pass, cpass
Dim sql,isql,rs
fname = Request.Form("fname")
lname = Request.Form("lname")
email = Request.Form("email")
cususer = Request.Form("user")
cuspass = Request.Form("pass")
cpass = Request.Form("cpassl")
If ConnectDB() = True Then
sql = "select username from customers where username='"&cususer&"'"
set rs=conn.Execute(sql) ' line ที่มันบอก error
If Not rs.EOF Then
Response.Write "<b>Can not register, the username that you entered is already be used by the other</b><br>"
Response.Write "<a href='#' onclick='history.back()'>Back</a>"
Response.End
End If
isql = "insert into customers ( username,customerpass,firstname,lastname,email)"&" values ('"&cususer&"','"&cuspass&"','"&fname&"','"&lname&"','"&email&"')"
Conn.Execute(isql)
Response.Write "Registered successfull, please choose."
Response.Write "<a href=viewcart.asp>Cart</a> "
Response.Write "or <a href=checkout.asp>Checkout</a> "
Response.Write "as you want."
End If
Session("user") = cususer
rs.close
conn.Close
%>
และ อีก ERROR ที่ขึ้น คือ
The INSERT INTO statement contains the following unknown field name: 'username'. Make sure you have typed the name correctly, and try the operation again.
<%
Dim fname, lname, email, user, pass, cpass
Dim sql,isql,rs
fname = Request.Form("fname")
lname = Request.Form("lname")
email = Request.Form("email")
cususer = Request.Form("user")
cuspass = Request.Form("pass")
cpass = Request.Form("cpassl")
If ConnectDB() = True Then
'sql = "select username from customers where username='"&cususer&"'"
'set rs=conn.Execute(sql)
'If Not rs.EOF Then
' Response.Write "<b>Can not register, the username that you entered is already be used by the other</b><br>"
' Response.Write "<a href='#' onclick='history.back()'>Back</a>"
' Response.End
'End If
isql = "insert into customers ( username,customerpass,firstname,lastname,email)"&" values ('"&cususer&"','"&cuspass&"','"&fname&"','"&lname&"','"&email&"')"
Conn.Execute(isql)
Response.Write "Registered successfull, please choose."
Response.Write "<a href=viewcart.asp>Cart</a> "
Response.Write "or <a href=checkout.asp>Checkout</a> "
Response.Write "as you want."
End If
Session("user") = cususer
rs.close
conn.Close
%>