> the 5 lines are my fields in my database.....
Sorry, don't understand.
The five lines:
"App_Name=" & request.form("App_Name")&"'," &_
"App_Owner=" & request.form("App_Owner")&"'," &_
"Sect=" & request.form("Sect")&"'," &_
"Sect_Man=" & request.form("Sect_Man")&"'," &_
"Ext_Spd_Dial=" & request.form("Ext_Spd_Dial")&"'," &_
are not part of an ASP statement. Therefore ASP is rejecting them.
What are these five lines supposed to be achieving?
OK, on further reading, I may be beginning to understand. Are these supposed to be
the fields you want to update in your SQL?
If so, you are apparently not familiar with the syntax of an SQL update statement.
Please check it out before attempting to generate one from ASP. I can assure you that
you will have problems generating SQL if you don't know what SQL you should be
generating.
Your update statement has an asterisk in it. It should not have this.
A typical update statement has the key word "update", then the table name, then the
key word "set", then a series of set clauses (which are presumably the five lines
we're talking about), then the key word "where" and a where clause.
IMHO, the way you are putting your SQL statement together it cumbersome and probably
slow. You have:
SQLApp = "UPDATE * "
SQLApp = SQLApp & "FROM APPLICATION "
SQLApp = SQLApp & "WHERE App_Name = '" & App_Name & "' "
This use of three statements and string concatenation just inhibits the readability of
your code. You haven't done it in the other five lines. With it's problem still
present, this should be:
SQLApp = "UPDATE * " & _
"FROM APPLICATION " & _
"WHERE App_Name = '" & App_Name & "' "
This gives you a clearer picture of what your SQL will look like and shows the
incorrect syntax.
I recommend you also get into the habit of always enclosing table and field names in
brackets. On occasions, this will help the database engine determine that you are not
using a reserved word in the wrong place; on other occasions, it will serve to remind
the eye of which are your field/table names.
Last, but certainly not least, please ALWAYS put in a display statement to display the
SQL on the screen BEFORE you execute the SQL. This means that you are in no doubt as
to what the database engine is seeing. (It wouldn't have helped in this case, of
course, as the statement never got to the database engine, but I can guarantee you it
will help in the future.) If the display is annoying you once your code is debugged,
comment the display statement out (don't delete it) until you need it again.
Main point repeated. Please do not attempt to generate SQL from ASP until you are
absolutely sure of the actual format of the SQL statement.
Dave S
----- Original Message -----
From: nice guy
To: [EMAIL PROTECTED]
Sent: Wednesday, July 14, 2004 7:40 PM
Subject: [ASP] Unable to Update data in SQL SERVER
the 5 lines are my fields in my database.....
David Smart <[EMAIL PROTECTED]> wrote:The five lines following the third "SQLApp ="
line are not part of any statement.
Dave S
----- Original Message -----
From: nice guy
To: [EMAIL PROTECTED]
Sent: Wednesday, July 14, 2004 12:23 PM
Subject: [ASP] Unable to Update data in SQL SERVER
hi, i am problem editing my data in database. i search for the record, then click
edit, which goes to a form that displays the records, after editing, i press
update,(which goes to EditSubmit.asp) to update....the error is in this page.
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/ASFTS/project/EditSubmit.asp, line 13
below is my code for EditSubmit.asp ::::::
<%
App_Name = Request.QueryString("App_Name")
SQLApp = "UPDATE * "
SQLApp = SQLApp & "FROM APPLICATION "
SQLApp = SQLApp & "WHERE App_Name = '" & App_Name & "' "
"App_Name=" & request.form("App_Name")&"'," &_
"App_Owner=" & request.form("App_Owner")&"'," &_
"Sect=" & request.form("Sect")&"'," &_
"Sect_Man=" & request.form("Sect_Man")&"'," &_
"Ext_Spd_Dial=" & request.form("Ext_Spd_Dial")&"'," &_
Dim Connection, RS, SQLApp
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open "Provider=SQLOLEDB; Database=ASFTS;
Server=mkzsa018.ap.infineon.com; User ID=*****; Password=******"
Set RS = Connection.Execute(SQLApp)
%>
THanks guys
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.718 / Virus Database: 474 - Release Date: 9/07/2004
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/17folB/TM
--------------------------------------------------------------------~->
---------------------------------------------------------------------
Home : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
Post : [EMAIL PROTECTED]
Subscribe : [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/active-server-pages/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/