
December 2nd, 2002, 09:07 PM
|
|
Registered User
|
|
Join Date: Dec 2002
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Learning COM+
I am trying to use COM objects in my ASP code. I am still new to COM objects in ASP is the only problem. I am using VB6 to create my apartment threaded, in process component. Where I am having problems is creating/utilizing a ADO recordset. I have created and instantiated a connection object in the class initialize subroutine. That gets created no problem, but everytime I try to create a recordset object, I get errors. The erros says something along the lines of this object does not support automation. I started out using early binding, but that hasn't work so I have moved to late binding, and I still can not get it working. Here is the code that keeps breaking it.<br><br><div class="msgQuoteWrap"><div class="msgCode"><br>'************************************************* *******************************<br>' SUBROUTINE TO UPDATE PAGEVISITED COUNTER<br>'************************************************* *******************************<br>Private Sub UpdatePageCounter(strQuery As String)<br> On Error GoTo ErrorRoutine<br><br> Dim strSelectQuery As String, rs As New ADODB.Recordset, nHits As Integer<br> Dim strUpdateQuery As String<br><br> Set rs = CreateObject("ADODB.Recordset")<br> <br> strSelectQuery = "Select Times_Visited from Content " & strQuery<br><br> rs.Open strSelectQuery, cn, adOpenStatic, adLockOptimistic<br><br> If Not rs.EOF Then<br> nHits = rs("Times_Visited") + 1<br> Else<br> nHits = 1<br> End If<br><br> rs.Close<br><br> strUpdateQuery = "Update Content set Times_Visited = " & nHits & " " & strQuery<br> rs.Open strUpdateQuery, cn, adOpenStatic, adLockOptimistic<br><br> Set rs = Nothing<br><br> Exit Sub<br>ErrorRoutine:<br> myResponse("Response").Write "Object threw: " + Err.Description<br> Err.Raise 45000, "Navigator.UpdatePageCounter"<br>End Sub<br></div></div><br><br>The code actually breaks at 'Set rs = CreateObject("ADODB.Recordset")'<br><br>Do not ask me why, that is why I am posting here. Any help you guys could give would be greatly appreciated.
|