473,242 Members | 1,458 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

Cannot Find Error on this ASP

M P
Hi Team!

Hope that you could help me! Its been days since I made this script but I
cannot fix the problem! IE is prompting me that there is a Syntax Error but
it seems that the syntax is OK! Can you help me find the problem?

Note the fields PartNo and ItemDesc is the only text data type on my MS
Access database.
<%
Dim strSQL

Set conn= Server.CreateObject("ADODB.Connection")
conn.Open "FileDSN=dsn.dsn"
strSQL= "INSERT INTO tblItems
(PartNo,ItemDesc,Category,MinStockLevel,Cost,Curre ncy) "
strSQL= strSQL & "Values('" & Request.Form("txtPN") & "', '"
strSQL= strSQL & Request.Form("txtItemDesc") & "', "
strSQL= strSQL & Request.Form("txtCategory") & ", "
strSQL= strSQL & Request.Form("txtMinStock") & ", "
strSQL= strSQL & Request.Form("txtCost") & ", "
strSQL= strSQL & Request.Form("txtCurrency") & ")"

conn.Execute strSQL

conn.Close

%>
Jul 19 '05 #1
5 1613
I could be wrong but, the error appears to be with the following 2 lines;

<second line>
strSQL= strSQL & "Values('" & Request.Form("txtPN") & "', '"

<last line>
strSQL= strSQL & Request.Form("txtCurrency") & ")"

You've got a ' after Values( and at the end with the comma, but there's no
matching one at the end of the last line (closing the ")" )

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
M P <ma**@textguru.ph> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
Hi Team!

Hope that you could help me! Its been days since I made this script but I
cannot fix the problem! IE is prompting me that there is a Syntax Error but it seems that the syntax is OK! Can you help me find the problem?

Note the fields PartNo and ItemDesc is the only text data type on my MS
Access database.
<%
Dim strSQL

Set conn= Server.CreateObject("ADODB.Connection")
conn.Open "FileDSN=dsn.dsn"
strSQL= "INSERT INTO tblItems
(PartNo,ItemDesc,Category,MinStockLevel,Cost,Curre ncy) "
strSQL= strSQL & "Values('" & Request.Form("txtPN") & "', '"
strSQL= strSQL & Request.Form("txtItemDesc") & "', "
strSQL= strSQL & Request.Form("txtCategory") & ", "
strSQL= strSQL & Request.Form("txtMinStock") & ", "
strSQL= strSQL & Request.Form("txtCost") & ", "
strSQL= strSQL & Request.Form("txtCurrency") & ")"

conn.Execute strSQL

conn.Close

%>

Jul 19 '05 #2
Before:
conn.Execute strSQL

Do this:

<%
Response.Write(strSQL)
Response.End

conn.Execute strSQL
%>

and you will see your SQL statement printed to the screen. Examine it for
errors, or post it here.

Cheers
Ken
"M P" <ma**@textguru.ph> wrote in message
news:uQ**************@TK2MSFTNGP12.phx.gbl...
: Hi Team!
:
: Hope that you could help me! Its been days since I made this script but I
: cannot fix the problem! IE is prompting me that there is a Syntax Error
but
: it seems that the syntax is OK! Can you help me find the problem?
:
: Note the fields PartNo and ItemDesc is the only text data type on my MS
: Access database.
:
:
: <%
: Dim strSQL
:
: Set conn= Server.CreateObject("ADODB.Connection")
: conn.Open "FileDSN=dsn.dsn"
: strSQL= "INSERT INTO tblItems
: (PartNo,ItemDesc,Category,MinStockLevel,Cost,Curre ncy) "
: strSQL= strSQL & "Values('" & Request.Form("txtPN") & "', '"
: strSQL= strSQL & Request.Form("txtItemDesc") & "', "
: strSQL= strSQL & Request.Form("txtCategory") & ", "
: strSQL= strSQL & Request.Form("txtMinStock") & ", "
: strSQL= strSQL & Request.Form("txtCost") & ", "
: strSQL= strSQL & Request.Form("txtCurrency") & ")"
:
: conn.Execute strSQL
:
: conn.Close
:
: %>
:
:
Jul 19 '05 #3
Hi M

Assuming you've copied and pasted this text, then the issue will be with your SQL string (starting with "strSQL ="). On this line you've missed the ending " & _, so it should look like this

strSQL= "INSERT INTO tblItems" &

and on each line of the string thereafter you have the trailing ", but not the required & _. This is how it should be

Set conn= Server.CreateObject("ADODB.Connection"
conn.Open "FileDSN=dsn.dsn
strSQL= "INSERT INTO tblItems" &
(PartNo,ItemDesc,Category,MinStockLevel,Cost,Curre ncy) " &
strSQL= strSQL & "Values('" & Request.Form("txtPN") & "', '" &
strSQL= strSQL & Request.Form("txtItemDesc") & "', " &
strSQL= strSQL & Request.Form("txtCategory") & ", " &
strSQL= strSQL & Request.Form("txtMinStock") & ", " &
strSQL= strSQL & Request.Form("txtCost") & ", " &
strSQL= strSQL & Request.Form("txtCurrency") & ")

In any command or string in VBScript, if you want to break a single line statement up from one line into multiple, you need to add a underscore (_) to the end of the line. This is the character VBScript uses to indicate the next line is a continuum of the current line

Cheer
Lai

Jul 19 '05 #4
jon
Ensure that the non-text values do actually contain a numeric value, otherwise you will be posting back a blank - which will cause an error. Try adding a check function to ensure this i.e.

Function ConvNo(pNo)

If IsNumeric(pNo) Then
ConvNo = Cdbl(pNo)
Else
ConvNo = 0
End if

End Function

Then call this on each of the numeric field as:

ConvNo(Request.Form("txtCurrency"))

This will ensure that 0 is passed rather than "" on an expected numeric entry.

************************************************** ********************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
Jul 19 '05 #5

"Lain" <an*******@discussions.microsoft.com> wrote in message
news:C9**********************************@microsof t.com...
Hi M P

Assuming you've copied and pasted this text, then the issue will be with your SQL string (starting with "strSQL ="). On this line you've missed the
ending " & _, so it should look like this:
strSQL= "INSERT INTO tblItems" & _

and on each line of the string thereafter you have the trailing ", but not the required & _. This is how it should be:
Set conn= Server.CreateObject("ADODB.Connection")
conn.Open "FileDSN=dsn.dsn"
strSQL= "INSERT INTO tblItems" & _
(PartNo,ItemDesc,Category,MinStockLevel,Cost,Curre ncy) " & _
strSQL= strSQL & "Values('" & Request.Form("txtPN") & "', '" & _
strSQL= strSQL & Request.Form("txtItemDesc") & "', " & _
strSQL= strSQL & Request.Form("txtCategory") & ", " & _
strSQL= strSQL & Request.Form("txtMinStock") & ", " & _
strSQL= strSQL & Request.Form("txtCost") & ", " & _
strSQL= strSQL & Request.Form("txtCurrency") & ")"
In any command or string in VBScript, if you want to break a single line statement up from one line into multiple, you need to add a underscore (_)
to the end of the line. This is the character VBScript uses to indicate the
next line is a continuum of the current line.
Cheers
Lain


True enough but he's not breaking the line up !!

so he doesn't need the &_

Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
10
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat...
0
by: SampathTangudu | last post by:
Hi, We are trying to use the Hash Tables for passing information from one aspx page to another aspx page. We are using the below code. IsolatedStorageFile isoStore =...
1
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005...
3
by: David T. Ashley | last post by:
Hi, Red Hat Enterprise Linux 4.X. I'm writing command-line PHP scripts for the first time. I get the messages below. What do they mean? Are these operating system library modules, or...
0
by: Curious | last post by:
Hi, I'm not sure if this is the right place to post such command issues. If you know a better forum where people respond to messages fairly often, please let me know! Anyway, would appreciate...
4
by: GHUM | last post by:
The compile works, BUT linking fails: 2.5\Release\psycopg\_psycopg.def -Lc:\python25\libs -Lc: \python25\PCBuild -Lc:/p ostgres/83RC2/lib -lpython25 -lpq -lws2_32 -ladvapi32 -o build...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all, my problem is about services. I try comment you all steps for my issue: My development environment: Windows XP SP2
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi all, my problem is about services. I try comment you all steps for my issue: My development environment: Windows XP SP2
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.