|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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) %> |
|
#2
|
||||
|
||||
|
Trim requires a closing )
Code:
Trim(Request.Form("prodName")&
Should be Code:
Trim(Request.Form("prodName")) &
__________________
Tewl |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
Thank you, that was absolutely it. Talk about being blind. :-)))
|
|
#5
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Insert into |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|