Problem calling Com+ from asp...

Discussion in 'ASP General' started by Hagge, Feb 17, 2004.

  1. Hagge

    Hagge Guest

    Hi,
    I'm turning my application into a "DLL".
    Everything worked fine untill I try to do a "While" in my asp code.
    Then I recieve an error like this:
    "Object variable or With block variable not set"

    Please help me. I'm rather new to com programming

    My vb code look like this.


    Option Explicit

    Public sArticleID As String
    Public sArticleDesc As String
    Public iUnitPrice As Integer
    Public iQuantity As Integer
    Public sAdded As String
    Public sLoginGUID As String
    Public bUserActive As String
    Public iStock As Integer
    Public sFromTable As String
    Public oldArtID As String

    Private dbConn As ADODB.Connection
    Private rs As ADODB.Recordset
    Private SQL As String
    Private rowStatus As Boolean

    Private Sub Class_Initialize()

    rowStatus = False

    End Sub

    Private Property Get db()
    If dbConn Is Nothing Then
    Set dbConn = New Connection
    dbConn.ConnectionString = constConnectionString
    dbConn.Open
    End If

    Set db = dbConn
    End Property

    Public Property Let dataConn(str)
    constConnectionString = str
    End Property

    Public Function getItems(ByVal strCustomerNo As String, ByVal strPriceGroup
    As String, ByVal strSite As String) As Boolean

    ' If rowStatus is False then the query was not run before.
    If rowStatus = False Then
    If strPriceGroup <> "" Then
    ' Do nothing
    Else
    SQL = ""
    SQL = SQL & "EXEC sp_getBasket "
    SQL = SQL & "@sSite='" & strSite & "',"
    SQL = SQL & "@sCustomerNo='" & strCustomerNo & "',"
    SQL = SQL & "@sPriceGroup='" & strPriceGroup & "'"
    Set rs = db.Execute(SQL)
    rowStatus = True

    End If
    Else
    rs.MoveNext
    End If

    If rs.EOF Then
    rs.Close
    rowStatus = False
    getItems = False
    Exit Function
    End If

    sArticleID = rs("sArticleID")
    sArticleDesc = IfNull(rs("sArticleDesc"), "")
    iUnitPrice = rs("iUnitPrice")
    iQuantity = rs("iQuantity")
    sAdded = rs("sAdded")
    sLoginGUID = rs("sLoginGUID")
    bUserActive = rs("bUserActive")
    iStock = rs("iStock")
    sFromTable = rs("sFromTable")

    getItems = True

    End Function
     
    Hagge, Feb 17, 2004
    #1
    1. Advertising

  2. Hagge

    Hagge Guest

    I found the error, after 2 hours.
    I wrote If strPriceGroup <> "" Then should be =

    Sorry!
    // Hagge



    "Hagge" <> wrote in message
    news:...
    > Hi,
    > I'm turning my application into a "DLL".
    > Everything worked fine untill I try to do a "While" in my asp code.
    > Then I recieve an error like this:
    > "Object variable or With block variable not set"
    >
    > Please help me. I'm rather new to com programming
    >
    > My vb code look like this.
    >
    >
    > Option Explicit
    >
    > Public sArticleID As String
    > Public sArticleDesc As String
    > Public iUnitPrice As Integer
    > Public iQuantity As Integer
    > Public sAdded As String
    > Public sLoginGUID As String
    > Public bUserActive As String
    > Public iStock As Integer
    > Public sFromTable As String
    > Public oldArtID As String
    >
    > Private dbConn As ADODB.Connection
    > Private rs As ADODB.Recordset
    > Private SQL As String
    > Private rowStatus As Boolean
    >
    > Private Sub Class_Initialize()
    >
    > rowStatus = False
    >
    > End Sub
    >
    > Private Property Get db()
    > If dbConn Is Nothing Then
    > Set dbConn = New Connection
    > dbConn.ConnectionString = constConnectionString
    > dbConn.Open
    > End If
    >
    > Set db = dbConn
    > End Property
    >
    > Public Property Let dataConn(str)
    > constConnectionString = str
    > End Property
    >
    > Public Function getItems(ByVal strCustomerNo As String, ByVal

    strPriceGroup
    > As String, ByVal strSite As String) As Boolean
    >
    > ' If rowStatus is False then the query was not run before.
    > If rowStatus = False Then
    > If strPriceGroup <> "" Then
    > ' Do nothing
    > Else
    > SQL = ""
    > SQL = SQL & "EXEC sp_getBasket "
    > SQL = SQL & "@sSite='" & strSite & "',"
    > SQL = SQL & "@sCustomerNo='" & strCustomerNo & "',"
    > SQL = SQL & "@sPriceGroup='" & strPriceGroup & "'"
    > Set rs = db.Execute(SQL)
    > rowStatus = True
    >
    > End If
    > Else
    > rs.MoveNext
    > End If
    >
    > If rs.EOF Then
    > rs.Close
    > rowStatus = False
    > getItems = False
    > Exit Function
    > End If
    >
    > sArticleID = rs("sArticleID")
    > sArticleDesc = IfNull(rs("sArticleDesc"), "")
    > iUnitPrice = rs("iUnitPrice")
    > iQuantity = rs("iQuantity")
    > sAdded = rs("sAdded")
    > sLoginGUID = rs("sLoginGUID")
    > bUserActive = rs("bUserActive")
    > iStock = rs("iStock")
    > sFromTable = rs("sFromTable")
    >
    > getItems = True
    >
    > End Function
    >
    >
     
    Hagge, Feb 17, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Ternier
    Replies:
    4
    Views:
    4,014
    Cowboy \(Gregory A. Beamer\) [MVP]
    Jul 29, 2004
  2. =?Utf-8?B?TWFydGluIExlZQ==?=

    Calling FormsAuthentication.SignOut() after calling Response.Flush

    =?Utf-8?B?TWFydGluIExlZQ==?=, Sep 28, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    736
    =?Utf-8?B?RXRoZW0gQXp1bg==?=
    Sep 28, 2004
  3. Andreas Lagemann
    Replies:
    8
    Views:
    502
    Mike Wahler
    Jan 10, 2005
  4. tiwy
    Replies:
    0
    Views:
    453
  5. Divya
    Replies:
    2
    Views:
    203
    Bullschmidt
    May 11, 2004
Loading...

Share This Page