473,378 Members | 1,542 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,378 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 1620
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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.