Jeg er en temelig nybegynder med ASP og Databaser, men jeg kan ikke få dette
til at køre
>Kode Start
<%
'If the session variable is False or does not exsist then redirect the user
to the unauthorised user page
If Session("blnIsUserGood") = False or IsNull(Session("blnIsUserGood")) =
True then
'Redirect to unathorised user page
Response.Redirect"unauthorised_user_page.htm"
End If
'Dimension Variables
Dim strUserName 'Holds the name of the user
Dim strNavn, strAlias, strStorstev, strStartv, strMaal
Dim adoCon 'Database Connection Variable
Dim strCon 'Holds the Database driver and the path and name of the
database
Dim strConn 'Holds the Database driver and the path and name of the
database
Dim rsAddComments
Dim rsvaegt 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
Session.LCID = 1030
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less
connection
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../_private/vaegt.mdb") 'This one is for Access 2000/2002
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("../_private/vaegt.mdb") 'This one is for Access 2000/2002
'Create an ADO recordset object
Set rsvaegt = Server.CreateObject("ADODB.Recordset")
%>
<html>
<head>
<meta http-equiv="Content-Language" content="da">
<title>Godkend bruger</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<%
'Get the users name passed from the previous page
'strUserName = Request.QueryString("name")
'strAmt = Request.QueryString("amt")
if Request.ServerVariables("CONTENT_LENGTH") <> 0 then
strAmt = Trim(Request.Form("Amt"))
strNavn = Trim(Request.Form("Navn"))
strAlias = Trim(Request.Form("Alias"))
strStorstev = Trim(Request.Form("Storstev"))
strStartv = Trim(Request.Form("Startv"))
strMaal = Trim(Request.Form("Maal"))
end if
strSQL = "SELECT person.Navn, person.Alias, person.Storstev, person.Startv,
person.Maal, person.Amt FROM person where Amt LIKE '" & strAmt & "' and
Alias LIKE '" & strAlias & "';"
rsvaegt.Open strSQL, strCon
%>
</head>
<%
Response.Write strNavn & " " & strAmt & " " & strAlias
If rsvaegt.EOF Then
Response.Write "Bruger er OK " & strNavn & " " & strAmt & " " & strAlias
'rsAddComments.Close
strSQL = "SELECT person.Navn, person.Alias, person.Storstev,
person.Startv, person.Maal, person.Amt FROM person;"
rsAddComments.CursorType = 2
rsAddComments.LockType = 3
rsAddComments.Open strSQL, strCon
rsAddComments.AddNew
rsAddComments.Fields("Amt") = (strAmt)
rsAddComments.Fields("Navn") = (strNavn)
rsAddComments.Fields("Alias") = (strAlias)
rsAddComments.Fields("Storstev") = (strStorstev)
rsAddComments.Fields("Startv") = (strStartv)
rsAddComments.Fields("Maal") = (strMaal)
rsAddComments.Update
'Reset server objects
rsAddComments.Close
Set rsAddComments = Nothing
Set adoCon = Nothing
else
Response.Write "Bruger er IKKE OK " & strNavn & " " & strAmt & " " &
strAlias
'Close Objects before redirecting
Set adoCon = Nothing
Set strCon = Nothing
end if
%>
>Kode slut
Jeg får følgende fejlmeldelse
a.. Fejltype:
Microsoft JET Database Engine (0x80004005)
"" kan ikke bruges, fordi filen allerede er i brug.
/ringkobing/adm/validatebruger.asp, line 66
a.. Browsertype:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
a.. Side:
POST 105 bytes to /ringkobing/adm/validatebruger.asp
Linie 66 er rsAddComments.Open strSQL, strCon
Er der nogen som kan hjælpe ?
--
/Gert Kaae Hansen
www.tyksak.dk
kaae@tyksak.dk