Re: Migrating ASP/MSSQL app from IIS 4 to IIS 6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



The N just makes the string unicode. The sp_cursoropen procedure requires
nvarchar arguments.


WebTent wrote:
> The profiler show the following, not what 'N' is before the sql
> string:
>
> declare @P1 int
> set @P1=180150001
> declare @P2 int
> set @P2=8
> declare @P3 int
> set @P3=1
> declare @P4 int
> set @P4=0
> exec sp_cursoropen @P1 output, N'SELECT * FROM Sendout_Records', @P2
> output, @P3 output, @P4 output
> select @P1, @P2, @P3, @P4
>
> "Bob Barrows [MVP]" wrote:
>
>> WebTent wrote:
>>> We have moved an Internet and Intranet site over to our IIS 6 MS
>>> Small Business Server 2003. The Internet site works fine, but was
>>> done by a company recently. The Intranet site is older and we're
>>> having problems from the get go. The first thing I've hit a problem
>>> with, I cannot seem to track down the cause. I have the following
>>> code:
>>>
>>> Set cnn=Server.CreateObject("ADODB.Connection")
>>> cnn.Open "EXECBOB","SA",""
>>
>> 1. Don't use your sa account for your applications. Create a
>> limited-permission account to use instead. Using sa can lead to bad
>> habits. sa should only be used for server administration. Nothing
>> else. The potential for misuse in the wrong hands is huge.
>> 2. A blank password for the sa account?!? Have you never heard of
>> Code Red??? Hopefully you've just censored the password so you could
>> post your connection's Open statement.
>> 3. Avoid using ODBC: http://www.aspfaq.com/show.asp?id=2126
>>
>>> Set cmd = Server.CreateObject("ADODB.Command")
>>
>> It's not fatal, but I don't see why you are using an explicit Command
>> object.
>>
>>> cmd.ActiveConnection = cnn
>>> cmd.CommandType = 1
>>> Set rst = Server.CreateObject("ADODB.Recordset")
>>> cmd.CommandText = "SELECT * FROM Sendout_Records ORDER BY
>>
>> Don't use selstar: http://www.aspfaq.com/show.asp?id=2096
>>
>>> Arranged_Date DESC"
>>> rst.Open cmd, , 3, 1
>>
>> Again, nothing fatal, but I don't see why you are using anything but
>> the default forward-only cursor. This code could be simplified to:
>>
>> sSQL="SELECT <column list> FROM Sendout_Records " & _
>> "ORDER BY Arranged_Date DESC"
>> set rst=cnn.execute(sSQL,,1)
>>
>>> companyID=rst(6)
>>> apptDate=rst(1)
>>> latestJO="Congratulations to "&recruiterName(rst(11))&" for posting
>>> the latest send out: "&PCase(rst(10))&" with "
>>> rst.Close
>>>
>>> That recordset is coming back empty, however, if I run the
>>> commandText in the MSSQL ent mgr directlry, brings up many records.
>>
>> Use SQL Profiler to verify that the commad text you expect to be
>> executed is actually what is being exxecuted.
>>
>> 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.

--
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.


.



Relevant Pages