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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Receiving an error on post - shouldn't be as far as i know

Status
Not open for further replies.

LongFeiFengWu

Technical User
Nov 9, 2001
98
US
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.

/money/save.asp, line 6

Code:
<%

IF request.form("Dollars") > 0 THEN

[COLOR=#FF0000]objrec.open "Money",objcon,3,3[/color] [b] < --- Line 6[/b]

objrec.addnew

objrec("PDate") = request.form("PDate")
objrec("Type") = request.form("Type")
objrec("Amount") = request.form("Dollars") & "." & request.form("Cents")
objrec("EntryDate") = request.form("EntryDate")
objrec("Desc") = request.form("Desc")

objrec.update

ELSE

objrec.open "PDate",objcon,3,3

objrec.addnew

objrec("PDate") = request.form("MONTH") & "/" & request.form("DAY") & "/" & request.form("YEAR")

objrec.update

END IF

%>


&quot;If nothing within you stays rigid, outward things will disclose themselves. Moving, be like water. Still, be like a mirror. Respond like an echo.&quot; ~ Bruce Lee
 
Money should be a string, no quotes, and should have your sql statement...

www.sitesd.com
ASP WEB DEVELOPMENT
 
like :

"select * from money"

[thumbsup2]DreX
aKa - Robert
 
Fun stuff, it should be autodetecting tat you want it to opena table by name, but isn't. While substituting in an SQL statement would work, it might be a good idea to try specfying that you want to open a table. There is a 5th optional argumentfor the Open statement that is CommadType, so if you try
objrec.open "Money",objcon,3,3,2

you might be fine the way things are (2 means Table). That should force it to recognize Money as a table name and either start running corectlyor give you an error if a table doesn't exist by that name. The rest of your flags look fine (static and optimistic if my memory serves correctly).

You might, on the other hand, want to consider using an SQL INSERT statement. I think it would probbaly be a lot more efficient in this case as you would not be downloading the contents of your database to the webserver just to add a new record.

-T

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
Help, the rampaging, spear-waving, rabid network gnomes are after me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top