registrerings ting
Jeg har lavet en registrerings side som skal bruges til et community. Jeg kan sikkert godt selv finde fejlen, men gider ikke og sidde og fumle med det mere.Den kommer med følgende fejl når jeg prøver at oprette en bruger:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access-driver] Der er en syntaksfejl i INSERT INTO-sætningen.
register.asp, line 43
Linien hvor det er, er nok ikke så svær at finde.
Koden til siden er her nedenunder:
<!--#include file="includes/functions.asp"-->
<!--#include file="includes/inc_top.asp"-->
<%
If Request.Form("Add") <> "" Then
strError = ""
Level = "user"
Username = Trim(Request.Form("Username"))
Password = Trim(Request.Form("Password"))
PasswordA = Trim(Request.Form("PasswordA"))
Alias = Trim(Request.Form("Alias"))
Email = Trim(Request.Form("Email"))
If Len(Username) = 0 Then
strError = "You have to type a username!"
ElseIf Len(Password) = 0 Then
strError = "You have to type a password!"
ElseIf Len(PasswordA) = 0 Then
strError = "You have to type your password again!"
ElseIf Not Password = PasswordA Then
strError = "Your passwords did not match!"
ElseIf Len(Alias) > 20 Then
strError = "Your alias is too long!"
ElseIf Len(Alias) = 0 Then
strError = "You have to type a alias!"
ElseIf Len(Email) = 0 Then
strError = "You have to type your email adresse!"
ElseIf checkEmail(Email) = False Then
strError = "You have to type a valid e-mail adress!"
End If
If Len(strError) = 0 Then
Set RegisterTemp = Server.CreateObject("ADoDB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath("../db/clan_ld_db.mdb")
RegisterTemp.open DSN
'SQLCOUNTRY = "SELECT Countries,ID FROM [Countries] WHERE ID = "& M_CountryID
'Set rstemp = RegisterTemp.execute(SQLCOUNTRY)
'M_Country = rstemp("Countries")
'M_CountryID = rstemp("ID")
'rstemp.Close : set rstemp = Nothing
SQLREGISTER = "INSERT INTO [Users] (Level, Username, Password, PasswordA, Alias, Email) " &_
"VALUES ('" &Level& "', '" &Username& "', '" &Password& "', '" &passwordA& "', '" &Alias& "', '" &Email& "')"
Set rsRegister = RegisterTemp.execute(SQLREGISTER)
RegisterTemp.Close
Response.Redirect("login.asp")
Else
strError = "<font face=""verdana"" size=""1"" color=""#000000""><b>"& strError &"</b></font>"
End If
End If
%>
<td align="center" valign="top" height="135" width="425" background="design/Middle.jpg">
<font color="#000000" face="verdana" size="2"><br><br><br><br><br><br><br><br><br><br><br><b>Register</b></font>
</td>
<td align="left" valign="top" height="135" colspan="3">
<img src="design/Right.jpg" width="103" height="199"></td></tr>
<tr>
<td align="left" valign="top" width="31"> </td>
<td align="left" valign="top" width="16"><img src="gIf/pixel.gIf" width="1" height="1"></td>
<td align="left" valign="top" background="gIf/dims2B.gIf" width="12"> </td>
<td align="left" valign="top" width="425" bgcolor="C5C5C5">
<table align="center" border="0" cellpadding="0" cellspacing="0" width="425">
<tr>
<td align="center" width="100%"><%=strError%></td>
</tr>
</table><br>
<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" method="POST">
<table border="0" cellpadding="3" cellspacing="0" width="425">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td align="right" width="35%"><font color="#9D0B0E">*</font>Username: </font></td>
<td align="left" width="65%"><input size="30" type="text" name="Username" value="<%=Username%>"></td>
</tr>
<tr>
<td align="right" width="35%"><font color="#9D0B0E">*</font>Password: </font></td>
<td align="left" width="65%"><input size="30" type="password" name="Password" value="<%=Password%>"></td>
</tr>
<tr>
<td align="right" width="35%"><font color="#9D0B0E">*</font>Password Again: </font></td>
<td align="left" width="65%"><input size="30" type="password" name="PasswordA" value="<%=PasswordA%>"></td>
</tr>
<tr>
<td align="right" width="35%"><font color="#9D0B0E">*</font>Alias: </font></td>
<td align="left" width="65%"><input size="30" type="text" name="Alias" value="<%=Alias%>"></td>
</tr>
<tr>
<td align="right" width="35%"><font color="#9D0B0E">*</font>E-mail: </font></td>
<td align="left" width="65%"><input size="30" type="text" name="Email" value="<%=Email%>"></td>
</tr>
<tr>
<td width="35%"> </td>
<td width="65%"><input type="submit" value=" Register " name="Add"></td>
</tr>
</table>
<br><center>A field marked with <font color="#9D0B0E">*</font> is a field that have to me filled out!</center>
</td>
</tr>
</table>
</form>
<!--#include file="includes/inc_footer.asp"-->
På forhånd tak!
