Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Problem calling Com+ from asp...

Reply
Thread Tools

Problem calling Com+ from asp...

 
 
Hagge
Guest
Posts: n/a
 
      02-17-2004
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


 
Reply With Quote
 
 
 
 
Hagge
Guest
Posts: n/a
 
      02-17-2004
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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
c++ calling java calling c++ ... Klaus Friese C++ 7 08-15-2005 09:23 PM
calling virtual function results in calling function of base class... Andreas Lagemann C++ 8 01-10-2005 11:03 PM
calling virtual function results in calling function of base class ... tiwy C++ 0 01-09-2005 11:17 PM
Calling FormsAuthentication.SignOut() after calling Response.Flush =?Utf-8?B?TWFydGluIExlZQ==?= ASP .Net 1 09-28-2004 12:47 PM
Server Side button calling page_load before calling it's own click event. Ryan Ternier ASP .Net 4 07-29-2004 01:06 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57