ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 27th, 2000, 03:46 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
insert into error

<i><b>Originally posted by : David (branham@bright.net)</b></i><br />I am trying to get this form to insert text into my database, however i keep getting this error:<br />########################################<br />Microsoft OLE DB Provider for ODBC Drivers error '80040e14' <br /><br />[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. <br /><br />/saber/addsabersql.asp, line 24 <br />########################################<br /><br />I have tried to fix this problem, but have had no luck figuring out what is wrong. Any help would be appreciated, thanks.<br /><br />Dave<br /><br />(my html form and page to insert the data)<br />##############################################<br /><html><br /><br /><head><br /><title>signon</title><br /><br /></head><br /><br /><br /><body><br /><h3 align="center">SQL Add example</h3><br /><br /><br /><br /><td width="424"><form method="post" name="form1" action="addsabersql.asp"><br /> <p><strong>date</strong><br><br /> <input type="text" size="40" name="Date"><br><br /> <strong>Game</strong><br><br /> <input type="text" size="40" name="Game"><br><br /> <strong>Your Name</strong><br><br /> <input type="text" size="40" name="YourName"><br><br /> <p><input type="Submit" value="Submit New Example" name"b1"> </font></p><br /> </form><br /> </td><br /> </tr><br /></table><br /></center></div><br /><br /><p align="center"><!--LINE2--> <br><br /></p><br /><br /><p align="center"><br><br /></p><br /></body><br /></html><br /><br /><br />############################################<br /><br /><br /><%@ Language = "VBScript"%><br /><%<br />'Declare all local variables<br />dim conn<br />dim rs<br />dim strconn<br />dim strsql<br /><br />strsql = ""<br />'set connection string to local variable<br />strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/adoandsqladd2.mdb")<br /><br />'build the sql statement based on the input from the form<br />strSQL = "INSERT INTO tblSqlAdd(Date, Game, YourName)"<br />strSQL = strSQL & " SELECT "<br />strSQL = strSQL & "'" & request("Date") & "' as text1," <br />strSQL = strSQL & "'" & request("Game") & "' as text2,"<br />strSQL = strSQL & "'" & request("YourName") & "' as text3"<br /><br />'Set connection object <br />set conn = server.createobject("adodb.connection")<br />conn.open strconn<br />'Use the execute method of the connection object the insert the record<br />conn.execute(strSQL)<br />conn.close<br />set conn = nothing<br />%><br /><html><br /><br /><head><br /><title>SQL Add record example</title><br /></head><br /><br /><body><br /><% = "Your record has been added" %><br /></body><br /></html><br />

Reply With Quote
  #2  
Old March 30th, 2000, 02:39 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
<i><b>Originally posted by : Chris Snider (csnider@worldnet.att.net)</b></i><br />David,<br /><br />Your problem is in teh following code snippet:<br />...<br />'build the sql statement based on the input from the form<br />strSQL = "INSERT INTO tblSqlAdd(Date, Game, YourName)"<br />strSQL = strSQL & " SELECT "<br />strSQL = strSQL & "'" & request("Date") & "' as text1," <br />strSQL = strSQL & "'" & request("Game") & "' as text2,"<br />strSQL = strSQL & "'" & request("YourName") & "' as text3"<br />...<br /><br />Based on the comment about building the insert from the form input, it should read like this;<br />...'build the sql statement based on the input from the form<br />strSQL = "INSERT INTO tblSqlAdd(Date, Game, YourName)"<br />strSQL = strSQL & " VALUES ("<br />strSQL = strSQL & "'" & request("Date") & "' as text1," <br />strSQL = strSQL & "'" & request("Game") & "' as text2,"<br />strSQL = strSQL & "'" & request("YourName") & "' as text3"<br />strSQL = strSQL & ")"<br /><br />The original version of the SQL statement "INSERT INTO TABLE...SELECT" is telling the database engine to insert into the specified table the values found on an existing table. Switching your statement to the one I provided will take the data from the form and insert as a new record to the specified table.<br /><br />If you need further explanation or comments, please email me.<br /><br />Chris Snider<br /><br />------------<br />David at 3/27/2000 1:46:57 PM<br /><br />I am trying to get this form to insert text into my database, however i keep getting this error:<br />########################################<br />Microsoft OLE DB Provider for ODBC Drivers error '80040e14' <br /><br />[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. <br /><br />/saber/addsabersql.asp, line 24 <br />########################################<br /><br />I have tried to fix this problem, but have had no luck figuring out what is wrong. Any help would be appreciated, thanks.<br /><br />Dave<br /><br />(my html form and page to insert the data)<br />##############################################<br /><html><br /><br /><head><br /><title>signon</title><br /><br /></head><br /><br /><br /><body><br /><h3 align="center">SQL Add example</h3><br /><br /><br /><br /><td width="424"><form method="post" name="form1" action="addsabersql.asp"><br /> <p><strong>date</strong><br><br /> <input type="text" size="40" name="Date"><br><br /> <strong>Game</strong><br><br /> <input type="text" size="40" name="Game"><br><br /> <strong>Your Name</strong><br><br /> <input type="text" size="40" name="YourName"><br><br /> <p><input type="Submit" value="Submit New Example" name"b1"> </font></p><br /> </form><br /> </td><br /> </tr><br /></table><br /></center></div><br /><br /><p align="center"><!--LINE2--> <br><br /></p><br /><br /><p align="center"><br><br /></p><br /></body><br /></html><br /><br /><br />############################################<br /><br /><br /><%@ Language = "VBScript"%><br /><%<br />'Declare all local variables<br />dim conn<br />dim rs<br />dim strconn<br />dim strsql<br /><br />strsql = ""<br />'set connection string to local variable<br />strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/adoandsqladd2.mdb")<br /><br />'build the sql statement based on the input from the form<br />strSQL = "INSERT INTO tblSqlAdd(Date, Game, YourName)"<br />strSQL = strSQL & " SELECT "<br />strSQL = strSQL & "'" & request("Date") & "' as text1," <br />strSQL = strSQL & "'" & request("Game") & "' as text2,"<br />strSQL = strSQL & "'" & request("YourName") & "' as text3"<br /><br />'Set connection object <br />set conn = server.createobject("adodb.connection")<br />conn.open strconn<br />'Use the execute method of the connection object the insert the record<br />conn.execute(strSQL)<br />conn.close<br />set conn = nothing<br />%><br /><html><br /><br /><head><br /><title>SQL Add record example</title><br /></head><br /><br /><body><br /><% = "Your record has been added" %><br /></body><br /></html><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > insert into error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek