Hi guys.
I am making a simple ASP and database based webpage. The users are supposed to be able to enter data into a database. To this end, I have made some forms, and in this asp document I am trying to enter them into my database.
I get this error message:
Technical Information (for support personnel)
* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/drinkoprettelse.asp, line 39
Line 39 reads
Conn.Execute(strSQL)
I can read from the database just fine. Any ideas?
Here is the ASP code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<%
'Getting the forms, and replacing ' with "
stralkoholhtml = Request.Form("alkoholhtml")
stralkoholhtml = Replace(strTekst, "'", "''")
strnavnhtml = Request.Form("navnhtml")
strnavnhtml = Replace(strTekst, "'", "''")
strbeskrivelsehtml = Request.Form("beskrivelsehtml")
strbeskrivelsehtml = Replace(strTekst, "'", "''")
stringredienserhtml = Request.Form("ingredienserhtml")
stringredienserhtml = Replace(strTekst, "'", "''")
strtilberedninghtml = Request.Form("tilberedninghtml")
strtilberedninghtml = Replace(strTekst, "'", "''")
streffekthtml = Request.Form("effekthtml")
streffekthtml = Replace(strTekst, "'", "''")
'Database connection
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("drinksdatabase.mdb")
Conn.Open DSN
'Entering into database
strSQL = "Insert into drinks (alkohol, navn, beskrivelse, ingredienser, tilberedning, effekt) values('1', '" & strnavnhtml& "', '" & strbeskrivelsehtml& "', '" & stringredienserhtml& "', '" & strtilberedninghtml& "', '" & streffekthtml& "')"
Conn.Execute(strSQL)
' Close database connection
Conn.Close
Set Conn = Nothing
%>
<body>
</body>
</html>
I am making a simple ASP and database based webpage. The users are supposed to be able to enter data into a database. To this end, I have made some forms, and in this asp document I am trying to enter them into my database.
I get this error message:
Technical Information (for support personnel)
* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/drinkoprettelse.asp, line 39
Line 39 reads
Conn.Execute(strSQL)
I can read from the database just fine. Any ideas?
Here is the ASP code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<%
'Getting the forms, and replacing ' with "
stralkoholhtml = Request.Form("alkoholhtml")
stralkoholhtml = Replace(strTekst, "'", "''")
strnavnhtml = Request.Form("navnhtml")
strnavnhtml = Replace(strTekst, "'", "''")
strbeskrivelsehtml = Request.Form("beskrivelsehtml")
strbeskrivelsehtml = Replace(strTekst, "'", "''")
stringredienserhtml = Request.Form("ingredienserhtml")
stringredienserhtml = Replace(strTekst, "'", "''")
strtilberedninghtml = Request.Form("tilberedninghtml")
strtilberedninghtml = Replace(strTekst, "'", "''")
streffekthtml = Request.Form("effekthtml")
streffekthtml = Replace(strTekst, "'", "''")
'Database connection
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("drinksdatabase.mdb")
Conn.Open DSN
'Entering into database
strSQL = "Insert into drinks (alkohol, navn, beskrivelse, ingredienser, tilberedning, effekt) values('1', '" & strnavnhtml& "', '" & strbeskrivelsehtml& "', '" & stringredienserhtml& "', '" & strtilberedninghtml& "', '" & streffekthtml& "')"
Conn.Execute(strSQL)
' Close database connection
Conn.Close
Set Conn = Nothing
%>
<body>
</body>
</html>