Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Records to a Database - Expected Identifier Error

Status
Not open for further replies.

JoeM6

Programmer
Aug 5, 2000
53
0
0
US
gamecentral.20m.com
I have a script that adds a record to a database. I get an Expected Identifier Error when it processes. Ill show you what i have.
-------------
add.asp
This is the page where all the information is put in:
<form method='post' action='add2.asp'>
Game ID: <small>(Auto Number)</small>
Name of Game: <input type='text' name='Name'>
Type of game: <input type='text' name='Type'>
How many players: <input type='text' name='Players'>
What Browser: <input type='text' name='Browser'>
Ratings: <input type='text' name='Rating'>
Author: <input type='text' name='Author'>
Website: <input type='text' name='Website'>
E-mail: <input type='text' name='Email'>
Object: <input type='text' name='Object'>
Controls: <input type='text' name='Control'>
URL of Game: <input type='text' name='GameURL'>

<DD><input type='submit' value='Submit'><input type='reset' value='Reset'>
</form>
--------------

When the information is submitted, it goes on to the next page, add2.asp

-------------
add2.asp
I get an expected identifier error with an arrow pointing the the t in dim name, type

<%@ Language=VBscript %>
<% Option Explicit %>
<%
Dim name, type, players, browser, rating, author, website, email, object, control, gameurl, sql, conn, DSNtemp

name = request.form(&quot;Name&quot;)
type = request.form(&quot;Type&quot;)
players = request.form(&quot;Players&quot;)
browser = request.form(&quot;Browser&quot;)
rating = request.form(&quot;Rating&quot;)
author= request.form(&quot;Author&quot;)
website = request.form(&quot;Website&quot;)
email= request.form(&quot;Email&quot;)
object = request.form(&quot;Object&quot;)
control = request.form(&quot;Control&quot;)
gameurl= request.form(&quot;GameURL&quot;)

sql = &quot;INSERT INTO Games ( name, type, players, browser, rating, author, website, email, object, control, gameurl ) VALUES ( '&quot; & Name & &quot;', '&quot; & Type & &quot;', '&quot; & Players & &quot;', '&quot; & Browser & &quot;', '&quot; & Rating & &quot;', '&quot; & Author & &quot;', '&quot; & Website & &quot;', '&quot; & Email & &quot;', '&quot; & Object & &quot;', '&quot; & Control & &quot;', '&quot; & GameURL & &quot;');&quot;

Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DSNtemp = &quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot;
DSNtemp = DSNtemp & &quot;DBQ=&quot; & Server.MapPath(&quot;\gamew0rld\db\gameinfo.mdb&quot;) & &quot;;&quot;
conn.Open DSNtemp
conn.Execute(sql)
conn.Close
Set conn = nothing


response.redirect(&quot;add.asp&quot;)

%>
--------

Any clue?

JoeM6
JPMJR11@aol.com
 
I fixed it, I didnt realized you cant write to a new database, there has to be some information in it. Also, the field labled type was causeing some problems so i changed the name of it.

JoeM6
JPMJR11@aol.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top