473,324 Members | 2,268 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,324 software developers and data experts.

Syntax Error on SQL statement

I am getting a syntax error on my SQL statement, not sure if I am doing this
right. i am trying to pass a value from another form.

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' & <% =Request.Form(npName) %> & ')"

Jul 19 '05 #1
6 1359
dthmtlgod wrote:
I am getting a syntax error on my SQL statement, not sure if I am
doing this right. i am trying to pass a value from another form.

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' & <% =Request.Form(npName) %> & ')"


You have a closing parenthesis without an opening parenthesis. Using

response.write strsql

would make this easy to see.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
CJM

"dthmtlgod" <do*************@netzero.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I am getting a syntax error on my SQL statement, not sure if I am doing this right. i am trying to pass a value from another form.

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' & <% =Request.Form(npName) %> & ')"


Try:

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' " & Request.Form(npName) & " ' "

I've put spaces around the single quotes for clarity, but you can remove
them in your code.

CJM
Jul 19 '05 #3
OK. Thank you Bob.

That corrected the syntax error problem, however, it is not recognizing the
=Request.Form(npName) value. Do I need to set this as a value and pass it?
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
dthmtlgod wrote:
I am getting a syntax error on my SQL statement, not sure if I am
doing this right. i am trying to pass a value from another form.

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' & <% =Request.Form(npName) %> & ')"


You have a closing parenthesis without an opening parenthesis. Using

response.write strsql

would make this easy to see.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #4
CJM,

That is giving me the below error

Error Type:
Request object, ASP 0102 (0x80004005)
The function expects a string as input.
"CJM" <cj*******@newsgroups.nospam> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...

"dthmtlgod" <do*************@netzero.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I am getting a syntax error on my SQL statement, not sure if I am doing

this
right. i am trying to pass a value from another form.

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' & <% =Request.Form(npName) %> & ')"


Try:

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' " & Request.Form(npName) & " ' "

I've put spaces around the single quotes for clarity, but you can remove
them in your code.

CJM

Jul 19 '05 #5
Nevermind, I figured it out myself.

Needs quotes around ("npName")

Should have caught that in the first place.

"CJM" <cj*******@newsgroups.nospam> wrote in message
news:uS**************@TK2MSFTNGP15.phx.gbl...

"dthmtlgod" <do*************@netzero.net> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I am getting a syntax error on my SQL statement, not sure if I am doing

this
right. i am trying to pass a value from another form.

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' & <% =Request.Form(npName) %> & ')"


Try:

strsql = "select PrinterModel, PrinterName, IP_Address, Location from
Printers where PrinterName = ' " & Request.Form(npName) & " ' "

I've put spaces around the single quotes for clarity, but you can remove
them in your code.

CJM

Jul 19 '05 #6
CJM
Yep, missed that... sorry

"dthmtlgod" <do*************@netzero.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nevermind, I figured it out myself.

Needs quotes around ("npName")

Should have caught that in the first place.

Jul 19 '05 #7

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

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have the following two methods in an asp/jscript page - my problem is that without the update statement there is no error, but with the update statement I get the following error: ...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
7
by: Dave | last post by:
I have 2 tables, one with names, and another with addresses, joined by their CIVICID number (unique to the ADDRESSINFO table) in Oracle. I need to update a field in the NAMEINFO table for a...
7
by: kosta | last post by:
hello! one of my forms communicates with a database, and is supposed to add a row to a table using an Insert statement... however, I get a 'oledb - syntax error' exception... I have double...
3
by: Nathan Sokalski | last post by:
When trying to submit data to an Access database using ASP.NET I recieve the following error: System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41...
1
by: amitbadgi | last post by:
HI i am getting the foll error while conv an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in UPDATE statement. Source Error: Line...
5
by: amitbadgi | last post by:
Hi guys, I am getting the following error in teh insert statement , I am converting this asp application to asp.net, here is teh error, Exception Details:...
7
by: Csaba Gabor | last post by:
I feel like it's the twilight zone here as several seemingly trivial questions are bugging me. The first of the following three lines is a syntax error, while the last one is the only one that...
12
by: Brad Baker | last post by:
I am trying to write a simple ASP.net/C# page which allows users to select some values and produce a report based on a SQL query. I have a self posting dropdown form which allows users to select...
1
by: ajos | last post by:
hi evrybdy, the problem is:- i had this running before in jsp but when i changed the jsp page using struts tags there occoured a problem... when i enter values in the 2 text boxes and click enter...
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.