Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 408
  • Last Modified:

COM+ Visual basic

actually i am implementing  ObjectControl and my program calls this COM+ application the problem is i get a run time error saying that the object not set heres the code for my COM+ application

Implements ObjectControl
' Declare Object Context object
Private m_objContxt  As ObjectContext
Private m_strConnection As String
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Sub ObjectControl_Activate()
Set m_objContxt = GetObjectContext
End Sub

Private Function ObjectControl_CanBePooled() As Boolean
 'For VB its always false so give that value
    ObjectControl_CanBePooled = False
End Function

Private Sub ObjectControl_Deactivate()
'Release the object context
 Set m_objContxt = Nothing
End Sub

Public Function TranferData(objTemp As Variant, strTableName As Variant) As Boolean
Dim objRsTemp As New Recordset
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset

On Error GoTo errorhandler
strConnection = GetConnectString()
conn.Open (strConnection)
Set rs = objTemp
         objRsTemp.CursorLocation = adUseClient
         objRsTemp.CursorType = adOpenDynamic
         objRsTemp.LockType = adLockBatchOptimistic
         objRsTemp.Open strTableName, conn
         
             'Copy to the temp recordset
            rs.MoveFirst
            Do Until rs.EOF
               objRsTemp.AddNew
                For intCount = 0 To rs.Fields.Count - 1
                    objRsTemp(intCount).Value = rs.Fields(intCount).Value
                Next
              rs.MoveNext
            Loop
      'Update
        'objRsTemp.Update
         objRsTemp.Properties("Update Criteria") = adCriteriaAllCols
         objRsTemp.UpdateBatch
         m_objContxt.SetComplete
         TranferData = True
       Exit Function
       
errorhandler:
m_objContxt.SetAbort
TranferData = False
Err.Raise Err.Number, , Err.Description



well i have registered this in Component service as i have got the msi file created then when my vb application calls this COM instead of first activating it directly executes the code in transfer data and finally when it tries m_objContxt.setComplete it gives a error object or variable not set can any one can sugesst me a ans for this

regards
srikanth

0
itssreekant
Asked:
itssreekant
1 Solution
 
aelatikCommented:
Try changing : Private m_objContxt  As ObjectContext tp Private m_objContxt  As New ObjectContext
0
 
rajaamirapuCommented:
How did you registered the dll in com plus application?
0
 
rajaamirapuCommented:
Can you see your component under component services
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Anthony PerkinsCommented:
Why bother with your record of open questions:

1 01/13/2003 50 Saving & Retriving Images  Unlocked Oracle
2 01/15/2003 40 Progress Bar in D2k  Unlocked 3rd Party Applications and Development Tools
3 03/04/2003 75 Selecting n rows from a databse randomly  Unlocked Oracle
4 03/05/2003 100 Lan & Fibre Optics  Unlocked Networking
5 03/27/2003 75 Expecting the result in a single query  Unlocked Oracle
6 03/27/2003 75 Result in a single query  Unlocked Microsoft SQL Server
7 06/14/2003 100 XML-Encryption & Decryption  Unlocked XML
8 07/17/2003 100 Crystal reports 9 and Stored Procedure i...  Unlocked Crystal Reports
9 08/25/2003 100 xmlhttp  Unlocked Visual Basic
10 08/25/2003 100 xmlhttp / xml to recordset conversion  Unlocked Visual Basic

Anthony
0
 
itssreekantAuthor Commented:
Hi all,
   Actually the problem was the property MtsTransactionMode  was set to NotAnMtsObject instead of RequiresNewTransaction  .Now the Problem is solved .

Thanks
Srikanth
0
 
Anthony PerkinsCommented:
>>Now the Problem is solved .<<
Than please go ahead and close this question.

Thanks,
Anthony
0
 
CetusMODCommented:
PAQed, with points refunded (200)

CetusMOD
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now