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!

Syntax error in INSERT INTO statement - Reserved Names

DreamWeaver 101

Syntax error in INSERT INTO statement - Reserved Names

by  schase  Posted    (Edited  )
Many tutorials kinda neglect to mention this to any detail.

But at some point your going to come accross a 80040e14 error - Syntax error in INSERT INTO statement.

Reserved name fields.

heres a link for more info on Macromedia
http://www.macromedia.com/support/ultradev/ts/documents/insert_into.htm

Now you could spend lots of time trying to pick and place what words you can use - or get into a habit early and start a naming convention.

Here is what I do.

Any database's I start with db like dbChase
any database tables I start with tbl like tblUsers
any database table fields I start with fld like fldFirstName
any database queries I start with qry like qryUsers

In any form fields I start with txt like txtFirstName

any Sessions I start with sv like svFirstName
any Dim's I start with str like strFirstName

it takes a little to get used too - but once you do - its much much easier. look at below code I will write, see if you can spot where they are residing - and what they are.

[color navy]
<%
Dim strFirstName
strFirstName = request.form("txtFirstName")


rsTemp = "SELECT * from tblUsers where fldUserName='" & strFirstName & " ORDER BY Session("svLastName") & " DESC"

%>[/color]

not a complete recordset, but see where everything is?

I'm getting strFirstName by populating it from a form text field named txtFirstName,
my SQL Statement says to take every record from table Users where the username = the first name populated earlier into strFirstName - then order by last name.

Not only is it much easier to keep track of - you never run into reserved names again.

Happy coding
Schase
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top