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

Why does my ASP code break when I move from IIS 5 to II 6

I copied a web project that ran fine on IIS 5 to IIS 6 using VID 6.0's copy
project function.

The web site appears to work fine except for pages that access a database.
When I try to view such a page on the IIS 6 box I get the following error:
Line 1: Incorrect syntax near '='.
/hours/includes/consult_info.asp, line 21
The line referenced by the error is shown below:
Set rs = Server.CreateObject("ADODB.recordset")
With rs
.ActiveConnection = cn
.source = sSql
.Open
End With
Why does my code break in IIS 6? It works fine on IIS 5.


Jul 19 '05 #1
8 1333
Which is line 21? If it is

.ActiveConnection = cn

and cn is a connection object try

set .ActiveConnection = cn

"Dave F" <da**@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
I copied a web project that ran fine on IIS 5 to IIS 6 using VID 6.0's copy project function.

The web site appears to work fine except for pages that access a database.
When I try to view such a page on the IIS 6 box I get the following error:
Line 1: Incorrect syntax near '='.
/hours/includes/consult_info.asp, line 21
The line referenced by the error is shown below:
Set rs = Server.CreateObject("ADODB.recordset")
With rs
.ActiveConnection = cn
.source = sSql
.Open
End With
Why does my code break in IIS 6? It works fine on IIS 5.

Jul 19 '05 #2
what is sSql, where is it coming from?

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Dave F" <da**@nospam.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
I copied a web project that ran fine on IIS 5 to IIS 6 using VID 6.0's copy project function.

The web site appears to work fine except for pages that access a database.
When I try to view such a page on the IIS 6 box I get the following error:
Line 1: Incorrect syntax near '='.
/hours/includes/consult_info.asp, line 21
The line referenced by the error is shown below:
Set rs = Server.CreateObject("ADODB.recordset")
With rs
.ActiveConnection = cn
.source = sSql
.Open
End With
Why does my code break in IIS 6? It works fine on IIS 5.

Jul 19 '05 #3
Dave F wrote:
I copied a web project that ran fine on IIS 5 to IIS 6 using VID
6.0's copy project function.

The web site appears to work fine except for pages that access a
database. When I try to view such a page on the IIS 6 box I get the
following error:
Line 1: Incorrect syntax near '='.
/hours/includes/consult_info.asp, line 21
The line referenced by the error is shown below:
Set rs = Server.CreateObject("ADODB.recordset")
With rs
.ActiveConnection = cn
.source = sSql
.Open
End With
Why does my code break in IIS 6? It works fine on IIS 5.


Which one is line 21?

".ActiveConnection = cn" should be "Set .ActiveConnection = cn" but that's
not a syntax error, just a performance inhibitor.

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
I agree with Curt, do this instead of the With rs section:

Response.Write sSql
Response.End

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Dave F" <da**@nospam.com> wrote in message
news:#M*************@TK2MSFTNGP10.phx.gbl...
I copied a web project that ran fine on IIS 5 to IIS 6 using VID 6.0's copy project function.

The web site appears to work fine except for pages that access a database.
When I try to view such a page on the IIS 6 box I get the following error:
Line 1: Incorrect syntax near '='.
/hours/includes/consult_info.asp, line 21
The line referenced by the error is shown below:
Set rs = Server.CreateObject("ADODB.recordset")
With rs
.ActiveConnection = cn
.source = sSql
.Open
End With
Why does my code break in IIS 6? It works fine on IIS 5.

Jul 19 '05 #5
Thanks Guys.

The offending line is:

rs.Source=sSql

I re-wrote the code as below but am still getting the error:

'open connection (defined in db_cn.asp include)
cn.open

'Get specified record:
sSQL = "usp_Sp_GetConsultInfo"
sSQL = sSQL & " @logon = " & shortuser

Set rs = Server.CreateObject("ADODB.recordset")

rs.ActiveConnection = cn

rs.Source=sSql '****error line
rs.Open

Do while not rs.EOF.....

I should mention that this is from an "include" file with an .asp extension.

This code was a direct copy from an IIS 5 machine that is running fine in
production.

Why would installing on IIS 6 cause a problem.


Jul 19 '05 #6
Dave F wrote:
Thanks Guys.

The offending line is:

rs.Source=sSql

I re-wrote the code as below but am still getting the error:

'open connection (defined in db_cn.asp include)
cn.open

'Get specified record:
sSQL = "usp_Sp_GetConsultInfo"
sSQL = sSQL & " @logon = " & shortuser


Look at the result of:

response.write sSQL

If @logon is a character parameter, then this line should have failed in
IIS5 since you did not delimit the parameter value.
Instead of that dynamic sql, I suggest using the following to execute your
procedure:

cn.usp_Sp_GetConsultInfo shortuser, rs

Now you no longer have to worry about delimiters or SQL Injection.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #7
Thanks very much Bob for helping me out.

My problem was that the "shortuser" variable was derived from:
Request.ServerVariables("AUTH_USER")

This returns a null in IIS 6 (but not IIS 5) and, as you pointed out,
because my parameter was not delimited, caused the error.

Thanks again for your help.

Dave

PS.
I have never seen a stored proc executed in the manner you showed (as a
property of a connection object):

cn.usp_Sp_GetConsultInfo shortuser, rs

How long have we been able to do this?



"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Od**************@TK2MSFTNGP10.phx.gbl...
Dave F wrote:
Thanks Guys.

The offending line is:

rs.Source=sSql

I re-wrote the code as below but am still getting the error:

'open connection (defined in db_cn.asp include)
cn.open

'Get specified record:
sSQL = "usp_Sp_GetConsultInfo"
sSQL = sSQL & " @logon = " & shortuser


Look at the result of:

response.write sSQL

If @logon is a character parameter, then this line should have failed in
IIS5 since you did not delimit the parameter value.
Instead of that dynamic sql, I suggest using the following to execute your
procedure:

cn.usp_Sp_GetConsultInfo shortuser, rs

Now you no longer have to worry about delimiters or SQL Injection.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #8
Request.ServerVariables("AUTH_USER") was returning a null because Allow
Anonymous Access was turned on for the IIS 6 web site. It should have
permitted only NT authentication.

This was the fundamental difference between the two web servers.


"Dave F" <da**@nospam.com> wrote in message
news:ur**************@tk2msftngp13.phx.gbl...
Thanks very much Bob for helping me out.

My problem was that the "shortuser" variable was derived from:
Request.ServerVariables("AUTH_USER")

This returns a null in IIS 6 (but not IIS 5) and, as you pointed out,
because my parameter was not delimited, caused the error.

Thanks again for your help.

Dave

PS.
I have never seen a stored proc executed in the manner you showed (as a
property of a connection object):

cn.usp_Sp_GetConsultInfo shortuser, rs

How long have we been able to do this?



"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Od**************@TK2MSFTNGP10.phx.gbl...
Dave F wrote:
Thanks Guys.

The offending line is:

rs.Source=sSql

I re-wrote the code as below but am still getting the error:

'open connection (defined in db_cn.asp include)
cn.open

'Get specified record:
sSQL = "usp_Sp_GetConsultInfo"
sSQL = sSQL & " @logon = " & shortuser


Look at the result of:

response.write sSQL

If @logon is a character parameter, then this line should have failed in
IIS5 since you did not delimit the parameter value.
Instead of that dynamic sql, I suggest using the following to execute your procedure:

cn.usp_Sp_GetConsultInfo shortuser, rs

Now you no longer have to worry about delimiters or SQL Injection.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Jul 19 '05 #9

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

Similar topics

8
by: ben | last post by:
i have a bit of code, that works absolutely fine as is, but seems over complicated/long winded. is there anyway to shorten/simplify it? the code is below. description of it: it's like strcpy in...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
18
by: Indian.croesus | last post by:
Hi, If I am right Endianness is CPU related. I do not know if the question is right in itself but if it is then how does C handle issues arising out of Endianness. I understand that if we pass...
4
SammyB
by: SammyB | last post by:
Our homework called for us to move a gif around in a canvas in an applet. Since it is an intro course, they used constants but I'm thinking, what if the user resizes the applet? So, I wrote the...
5
by: recordlovelife | last post by:
So i have written a code to encode a string of a select amount of letters into huffman code. #include <iostream> #include <string> using namespace std; string Huffman(char letter);...
8
by: inFocus | last post by:
Hello, I am new to python and wanted to write something for myself where after inputing two words it would search entire drive and when finding both names in files name would either copy or move...
17
by: radhikams | last post by:
Hi I want to create a drag drop tool box using javascript... Can anyone please guide me in this regard Thanks
1
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input...
2
by: prakatak7410 | last post by:
#include<iostream> #include<string> #include<cctype> using namespace std; struct SEAT { bool occupied; // initially, false string first,last; // passenger name int numBags; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.