More webpage coding help please!!
Posted: 20 Nov 2006, 19:44
Hey all. Got a lot of my info on my webpage on a database now and am trying to get myself a form together so that I can add records to it instead of uploading the entire database again everytime something is changed. Copied some forms for this that I've seen online but getting the following error:
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/database/add_to_database2.asp, line 82, column 12
INSERT INTO dvds (filename, title, origin, reviewed, format, rating, recent)
-----------^
I've got hte database at the path given, and the table I'm adding to is called dvds, and the columns in it are filename, title, origin, reviewed, format, rating, recent.
The error refers to the INSERT INTO line...
--------------------
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
Dim strConnString
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Web-page\database\films.mdb"
Dim cnnFormToDB ' CONN object
Dim strTextFieldA
Dim strTextFieldB
Dim strTextFieldC
Dim strTextFieldD
Dim strTextFieldE ' text field
Dim intIntegerFieldA
Dim intIntegerFieldB ' integer field
If Request.Form("action") <> "Save Form Data" Then
' Show the form
%>
<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post">
<input type="hidden" name="action" value="Save Form Data" />
<table width="80%" border="0">
<tr>
<td>filename :</td>
<td><input type="text" name="filename" size="20"></td>
</tr>
<tr>
<td>Film Title :</td>
<td> <input type="text" name="title" size="20"></td>
</tr>
<tr>
<td>Origin :</td>
<td><input type="text" name="origin" size="20"></td>
</tr>
<tr>
<td>Reviewed :</td>
<td><input type="text" name="reviewed" size="20"></td>
</tr>
<tr>
<td>Review type :</td>
<td><input type="text" name="format" size="20"></td>
</tr>
<tr>
<td>Rating :</td>
<td><input type="text" name="rating" size="20"></td>
</tr>
<tr>
<td>Date (yyyymmdd) :</td>
<td><input type="text" name="recent" size="20"></td>
</tr> <td> </td>
<td>
<input type="reset" value="Clear" />
<input type="submit" value="Save" />
</td>
</tr>
</table>
</form>
<%
Else
strTextFieldA = Request.Form("filename")
strTextFieldB = Request.Form("title")
strTextFieldC = Request.Form("origin")
strTextFieldD = Request.Form("reviewed")
strTextFieldE = Request.Form("format")
intIntegerFieldA = Request.Form("rating")
intIntegerFieldB = Request.Form("recent")
Set cnnFormToDB = Server.CreateObject("ADODB.Connection")
cnnFormToDB.Open strConnString
INSERT INTO dvds (filename, title, origin, reviewed, format, rating, recent)
VALUES ('"&strTextFieldA&"','"&strTextFieldB&"','"&strTextFieldC&"','"&strTextFieldD&"','"&strTextFieldE&"',intIntegerFieldA,intIntegerFieldB)
cnnFormToDB.Close
Set cnnFormToDB = Nothing
%>
<h2>Thanks for submitting your information to us!</h2>
<%
End If
%>
</body>
</html>
---------------------
If you can help, it would be appreciated!!!
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/database/add_to_database2.asp, line 82, column 12
INSERT INTO dvds (filename, title, origin, reviewed, format, rating, recent)
-----------^
I've got hte database at the path given, and the table I'm adding to is called dvds, and the columns in it are filename, title, origin, reviewed, format, rating, recent.
The error refers to the INSERT INTO line...
--------------------
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
Dim strConnString
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Web-page\database\films.mdb"
Dim cnnFormToDB ' CONN object
Dim strTextFieldA
Dim strTextFieldB
Dim strTextFieldC
Dim strTextFieldD
Dim strTextFieldE ' text field
Dim intIntegerFieldA
Dim intIntegerFieldB ' integer field
If Request.Form("action") <> "Save Form Data" Then
' Show the form
%>
<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post">
<input type="hidden" name="action" value="Save Form Data" />
<table width="80%" border="0">
<tr>
<td>filename :</td>
<td><input type="text" name="filename" size="20"></td>
</tr>
<tr>
<td>Film Title :</td>
<td> <input type="text" name="title" size="20"></td>
</tr>
<tr>
<td>Origin :</td>
<td><input type="text" name="origin" size="20"></td>
</tr>
<tr>
<td>Reviewed :</td>
<td><input type="text" name="reviewed" size="20"></td>
</tr>
<tr>
<td>Review type :</td>
<td><input type="text" name="format" size="20"></td>
</tr>
<tr>
<td>Rating :</td>
<td><input type="text" name="rating" size="20"></td>
</tr>
<tr>
<td>Date (yyyymmdd) :</td>
<td><input type="text" name="recent" size="20"></td>
</tr> <td> </td>
<td>
<input type="reset" value="Clear" />
<input type="submit" value="Save" />
</td>
</tr>
</table>
</form>
<%
Else
strTextFieldA = Request.Form("filename")
strTextFieldB = Request.Form("title")
strTextFieldC = Request.Form("origin")
strTextFieldD = Request.Form("reviewed")
strTextFieldE = Request.Form("format")
intIntegerFieldA = Request.Form("rating")
intIntegerFieldB = Request.Form("recent")
Set cnnFormToDB = Server.CreateObject("ADODB.Connection")
cnnFormToDB.Open strConnString
INSERT INTO dvds (filename, title, origin, reviewed, format, rating, recent)
VALUES ('"&strTextFieldA&"','"&strTextFieldB&"','"&strTextFieldC&"','"&strTextFieldD&"','"&strTextFieldE&"',intIntegerFieldA,intIntegerFieldB)
cnnFormToDB.Close
Set cnnFormToDB = Nothing
%>
<h2>Thanks for submitting your information to us!</h2>
<%
End If
%>
</body>
</html>
---------------------
If you can help, it would be appreciated!!!