White_Rose
06-08-2002, 13:45
Mong mọi người chỉ giúp. File CSDL có một bảng tên là Counter như sau:
username : text(50)
email : text(50)
password : text(50)
counter : Long Integer
File add.asp như sau:
<%
Response.Buffer = True
Response.Write "<HTML><BODY>"
If IsEmpty(Request.Form ("username")) OR IsEmpty(Request.Form ("password")) OR IsEmpty(Request.Form ("email")) then
Response.Write "You have to fill all fields"
else
Dim username, password, email
username = Request.Form ("username")
password = Request.Form ("password")
email = Request.Form ("email")
if (username="") or (password="") or (email="") then
Response.write "Not allow blank field"
else
Dim strSQL, myConn, rsCounter
strSql = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath ("counter.mdb")
Set myConn = Server.CreateObject ("ADODB.Connection")
myConn.Open strSql
strSql = "SELECT * FROM Counter WHERE username='" & username & "';"
Set rsCounter = MyConn.Execute(strSql)
if rsCounter.EOF <> True then
rsCounter.close
Set rsCounter = Nothing
myConn.Close
Set myconn = Nothing
Response.Write "Username is existed"
else
rsCounter.Close
Set rsCounter = Nothing
strSQL = "INSERT INTO Counter (username, password, counter, email) VALUES ('" & username & "', '" & password & "', 0, '" & email & "');"
myConn.Execute strSql
myConn.Close
Set myConn = Nothing
Response.Write "You have been registerd!<br>o"
end if
end if
end if
Response.Write "<br><a href=""default.asp"">Back to Register</a></BODY></HTML>"
%>
Lỗi mà IE thông báo:
· Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in FROM clause.
/counter/Add.asp, line 19
· Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; NetCaptor 7.0.1)
· Page:
POST 31 bytes to /counter/Add.asp
· POST Data:
username=23&password=2&email=23
username : text(50)
email : text(50)
password : text(50)
counter : Long Integer
File add.asp như sau:
<%
Response.Buffer = True
Response.Write "<HTML><BODY>"
If IsEmpty(Request.Form ("username")) OR IsEmpty(Request.Form ("password")) OR IsEmpty(Request.Form ("email")) then
Response.Write "You have to fill all fields"
else
Dim username, password, email
username = Request.Form ("username")
password = Request.Form ("password")
email = Request.Form ("email")
if (username="") or (password="") or (email="") then
Response.write "Not allow blank field"
else
Dim strSQL, myConn, rsCounter
strSql = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath ("counter.mdb")
Set myConn = Server.CreateObject ("ADODB.Connection")
myConn.Open strSql
strSql = "SELECT * FROM Counter WHERE username='" & username & "';"
Set rsCounter = MyConn.Execute(strSql)
if rsCounter.EOF <> True then
rsCounter.close
Set rsCounter = Nothing
myConn.Close
Set myconn = Nothing
Response.Write "Username is existed"
else
rsCounter.Close
Set rsCounter = Nothing
strSQL = "INSERT INTO Counter (username, password, counter, email) VALUES ('" & username & "', '" & password & "', 0, '" & email & "');"
myConn.Execute strSql
myConn.Close
Set myConn = Nothing
Response.Write "You have been registerd!<br>o"
end if
end if
end if
Response.Write "<br><a href=""default.asp"">Back to Register</a></BODY></HTML>"
%>
Lỗi mà IE thông báo:
· Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in FROM clause.
/counter/Add.asp, line 19
· Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; NetCaptor 7.0.1)
· Page:
POST 31 bytes to /counter/Add.asp
· POST Data:
username=23&password=2&email=23