Jeg har nu sidet og rodet lidt rundt med denne kode i 1 par dage
og jeg kan ikke få den til at virke, når jeg trykker på "opret"
får jeg bare standard meddelelsen om at siden ikke kan vises, og
når jeg prøver at logge ind med den nye bruger virker den ikke.
Nogen ASP-Hajer der kan gennemskue hvad jeg gør forkert???
(Se selve siden her:
http://www.friserverplads.dk/bogologo/asp/index.htm)
Her er hele koden for min "opret" side:
<%@ Language = "VBScript" %>
<%
Dim strUser ' user field
Dim intPass ' pass field
Dim cnnRegister
Dim strUsername, strPassword
Dim strSQL
If Request.Form("action") <> "save" Then
%>
<html>
<head>
<title>About</title>
<link rel="stylesheet" type="text/css" href="midt-style.css">
</head>
<body topmargin="0" leftmargin="0">
<table cellpadding="0" cellspacing="0" border=0 width=479>
<tr>
<td class="overskrift">.
ret</td>
</tr>
<tr>
<td>Her kan du i fremtiden oprette din egen bruger...
<form action="action" method="post" target="midt">
<input type="hidden" name="action" value="save">
<table class="indhold" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td class="login">
Brugernavn:
</td>
<td>
</td>
<tr>
<td class="felt">
<input class="write" type="text" name="User">
<td>
</tr>
<tr>
<td class="login">
Password:
</td>
<td>
</td>
</tr>
<tr>
<td class="felt">
<input class="write" type="password" name="Pass">
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
<input class="knap" type="image" src="images/opret.gif"
onFocus="blur()" value="opret" name="opret"></td>
<td>
</td>
</tr>
</table>
</form>
<%
Else
strUser = Request.Form("User")
intPass = Request.Form("Pass")
strUser = Replace(username, "'", "''")
intPass = Replace(password, "'", "''")
On Error Resume Next
strErrorMsg = ""
strUser = Trim(strUser)
If Len(strUser) = 0 Or Len(strUser) > 10 Then Err.Raise 1
strUser = Replace(strUser, "'", "''")
If Err.number <> 0 Then
strErrorMsg = strErrorMsg & "Your entry for string_field is " &
_
"inappropriate!<br />" & vbCrLf
Err.Clear
End If
strPass = Trim(strPass)
If Len(strPass) = 0 Or Len(strPass) > 10 Then Err.Raise 1
strPass = Replace(strPass, "'", "''")
If Err.number <> 0 Then
strErrorMsg = strErrorMsg & "Your entry for string_field is " &
_
"inappropriate!<br />" & vbCrLf
Err.Clear
End If
On Error Goto 0
If strErrorMsg <> "" Then
' Show the error message that got us here!
Response.Write strErrorMsg
Else
Set cnnRegister = Server.CreateObject("ADODB.Connection")
cnnRegister.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("user.mdb"))
cnnRegister.Open strConnString
' Build our SQL String
strSQL = ""
strSQL = strSQL & "INSERT INTO tblLoginInfo "
strSQL = strSQL & "(Username, Password) " & vbCrLf
strSQL = strSQL & "VALUES ("
strSQL = strSQL & "'" & strUser & "'"
strSQL = strSQL & ", "
strSQL = strSQL & intPass
strSQL = strSQL & ");"
cnnRegister.Execute strSQL, adCmdText Or adExecuteNoRecords
cnnRegister.Close
Set cnnRegister = Nothing
%>
<h2>Thanks for submitting your information to us!</h2>
<p>
<strong>The resulting SQL statement was:</strong>
<pre><%= strSQL %></pre>
<%
End If
End If
%>
<p> </p>
</td>
</tr>
</table>
</body>
</html>
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP ???
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials