H
Hagge
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
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