Using Recordsets ASP / VBScript

by Nathan 29. March 2009 08:45

 

If you receive this error 

ADODB.Recordset error '800a0e78'

Operation is not allowed when the object is closed.

you will need to check the state of the recordset as in the code below before you access any properties of the object

 


if not oRs.state <> 1 then

        if not oRs.eof then

              if oRs("Value").Value > 0 then
                 myval = oRs("Value").Value
            else
           myval = 0     
            end if
        end if
    else
        Response.Write "Cannot find any records"
    end if
   

Tags: ,

ASP

Unable to cast object of type 'System.Web.Configuration.ScriptingAuthenticationServiceSection' to type 'System.Web.Configuration.ScriptingAuthenticationServiceSection'.

by Nathan 29. March 2009 08:42

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: The entry 'ScriptModule' has already been added.

Source Error:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>


This happens when the config for a virtual directory is already defined in the root web application

There are two ways you can fix this:

<remove name="ScriptModule" />

Alternatively you can stop the  the web.config inheritance to the the virtual directory.
by adding this to the parent web.config

    <location path="." inheritInChildApplications="false">
    <system.web>
    ...
    </system.web>
    </location>

 

I found out that the root application had .NET 3.5 references in the web.config

I tried to remove this using:

    <location path="." inheritInChildApplications="false">
    <system.web>
    ...
    </system.web>
    </location>


the problem actually occured due to the  3.5 reference in the <configSections>

Tags:

ASP.NET

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

by Nathan 29. March 2009 08:29

I have come across this error when using a Indentity In a stored procedure.

In a stored procedure you need to define the scope indentity in a variable before you can use it in a select statement

So instead of

SELECT * FROM table WHERE id = SCOPE_IDENTITY()

You need to use 

 

SET @var = SCOPE_IDENTITY();

SELECT * FROM table WHERE id = @var

 

 @@IDENTITY  will return the last indentity across the whole database whilst SCOPE_IDENTITY() will return only the indentity related to the scope of the operation

Tags:

SQL

Powered by BlogEngine.NET 1.6.0.0
Theme by Mads Kristensen