SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 12th, 2003, 01:46 PM
pmagnan pmagnan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 2 pmagnan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Insert into

Hi,

I am very new at this and ding this in context of a course. I am getting an error stating
Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'

Can you please look at this and tell me where I went wrong ?


<% @LANGUAGE= VBScript%>
<%Option Explicit%>
<%
'Database variables
Dim dbConnect, dbSqlstate, dbWhere, dbReturn

'create ADO connection
Set dbConnect = Server.CreateObject("ADODB.Connection")

' indicate where db is located
dbWhere = Server.MapPath("db\db.mdb")

'open connection
dbConnect.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&dbWhere

' SQL statement to insert to db

dbSqlstate = "Insert INTO prodList(prodName,prodCode,prodDesc, prodPrice)"
dbSqlstate = dbsqlState & " VALUES ("
dbSqlstate = dbSqlstate & "'" & Trim(Request.Form("prodName")& "',"
dbSqlstate = dbSqlstate & "'" & Trim(Request.Form("prodCode")& "',"
dbSqlstate = dbSqlstate & "'" & Trim(Request.Form("prodDesc")& "',"
dbSqlstate = dbSqlstate & "'" & Trim(Request.Form("prodPrice")& "')"


dbConnect.Execute(dbSqlstate)
%>

Reply With Quote
  #2  
Old July 12th, 2003, 04:44 PM
Tewl's Avatar
Tewl Tewl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 47 Tewl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 13 sec
Reputation Power: 6
Trim requires a closing )

Code:
  Trim(Request.Form("prodName")&


Should be

Code:
  Trim(Request.Form("prodName")) & 
__________________
Tewl

Reply With Quote
  #3  
Old July 12th, 2003, 05:04 PM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
I also have a problem with the insert into:

my script goes like this, after i opend the database (conn-connection, rs-recordset):

"
sql = "insert into " & tbn & "(" & rs(1).name & "," & rs(2).name & "," & rs(3).name & "," & rs(4).name & ") values ( '" & ts1 & "' , '" & tft1 & "' , '" & t2 & "' , '" & dt & "' )"
conn.Execute sql
"

the error message:

"Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.

/tests/dbr/wr2.asp, line 30
"

the stupid of it is that is that with 3 parameters of feilds and values it works fine, is it the syntax or is the insert into limitted to 3 parameters?

thanks, ben.

Reply With Quote
  #4  
Old July 12th, 2003, 11:19 PM
pmagnan pmagnan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 2 pmagnan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you, that was absolutely it. Talk about being blind. :-)))

Reply With Quote
  #5  
Old July 13th, 2003, 12:37 AM
rgdubey rgdubey is offline
I am here to share knowledge
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: India
Posts: 83 rgdubey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
you are making the query too much complecated, always remember the query should be simple

just try this

prodname=Trim(Request.Form("prodName")
prodCode=Trim(Request.Form("prodCode")
prodDesc=Trim(Request.Form("prodDesc")
prodPrice=Trim(Request.Form("prodPrice")


dbSqlstate = "Insert INTO prodList(prodName,prodCode,prodDesc, prodPrice) values ('"&prodname&"', '"&prodCode&"', '"&prodDesc&"', '"&prodPrice&"')"


Always remember keep the query as simple as you can because it is easy to debug and easy to understand
__________________
Rahul

Small things lead to perfection and perfection is not a small thing.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Insert into


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway