-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: shyam_patil
Message 10 in Discussion
hi kalpesh i tried it in VBA project. i got the following error an error occured
in NAS_TransDB.nasEmp_Mst.GetAll File name or class name not found during Automation
operation. actually it creates the Object, but when i call any method it gives error
for all the class in the dll. the class is developed to be deployed in MTS but
even if use it as a non MTS component (MTSTransactionMode=NOTAnMTSObject) it gives
the same error i'm posting the class code , with single method i there is anythig
missing pls suggest, i have not test it on win2000 let me also try on it ,.. i will
let know if it works on win2000 or not Option Explicit
Implements ObjectControl
'******************************************************************************
'* *
'* Name: nasEmp_Mst.cls *
'* *
'* Purpose: Standard database access class for table 'nasEmp_Mst'. *
'* *
'*----------------------------------------------------------------------------*
'* Modification Log *
'* . *
'* *
'******************************************************************************
Private Const MODULE_NAME = "nasEmp_Mst" Private mobjCtx As ObjectContext '// MTS
Object context. Private Sub ObjectControl_Activate()
'******************************************************************************
'* *
'* Name: ObjectControl_Activate *
'* *
'* Purpose: Get Object Context for Communication with MTS. *
'* *
'******************************************************************************
On Error GoTo ObjectControl_Activate_Error Set mobjCtx = GetObjectContext()
ObjectControl_Activate_Done:
Exit Sub ObjectControl_Activate_Error:
Call Process_Error(MODULE_NAME, "ObjectControl_Activate")
Resume ObjectControl_Activate_Done End Sub
Public Function GetAll(Optional ByVal vstrEmp_ID As Variant, _
Optional ByVal vstrFirst_Name As Variant, _
Optional ByVal vstrLast_Name As Variant, _
Optional ByVal vstrAddress As Variant, _
Optional ByVal vstrCity As Variant, _
Optional ByVal vstrCountry As Variant, _
Optional ByVal vstrPINCode As Variant, _
Optional ByVal vstrPhone As Variant, _
Optional ByVal vstrE_Mail As Variant, _
Optional ByVal vstrCompanyID As Variant, _
Optional ByVal vstrEmp_Cat As Variant, _
Optional ByVal vstrLogin_Name As Variant, _
Optional ByVal vstrLogin_Pwd As Variant, _
Optional ByVal vstrULoginStatus As Variant, _
Optional ByVal vdteActivation_Dt As Variant, _
Optional ByVal vstrCreatedBy As Variant, _
Optional ByVal vstrState As Variant, _
Optional ByVal vstrStatus As Variant, _
Optional ByVal vstrLogin_Mc_Ip As Variant, _
Optional ByVal vstrf10 As Variant) As ADODB.Recordset
'******************************************************************************
'* *
'* Name: GetAll *
'* *
'* Purpose: Get all records according to specified criteria. *
'* *
'* Returns: A detached ADO recordset object containing the specified data. *
'* *
'******************************************************************************
On Error GoTo GetAll_Error Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
'// Initialise recordset
Set rs = New ADODB.Recordset
'// SQL 'SELECT' string
strSQL = "SELECT Emp_ID " & _
" ,First_Name " & _
" ,Last_Name " & _
" ,Address " & _
" ,City " & _
" ,Country " & _
" ,PINCode " & _
" ,Phone " & _
" ,E_Mail " & _
" ,CompanyID " & _
" ,Emp_Cat " & _
" ,Login_Name " & _
" ,Login_Pwd " & _
" ,ULoginStatus " & _
" ,Activation_Dt " & _
" ,CreatedBy " & _
" ,State " & _
" ,Status " & _
" ,Login_Mc_Ip " & _
" ,f10 " & _
" FROM nasEmp_Mst " & _
" WHERE " '// Criteria - use 'AND'
If Not IsMissing(vstrEmp_ID) Then strSQL = strSQL & " Emp_ID = " & "'" &
Replace(vstrEmp_ID, "'", "''") & "'" & " AND "
If Not IsMissing(vstrFirst_Name) Then strSQL = strSQL & " First_Name = " & "'" &
Replace(vstrFirst_Name, "'", "''") & "'" & " AND "
If Not IsMissing(vstrLast_Name) Then strSQL = strSQL & " Last_Name = " & "'" &
Replace(vstrLast_Name, "'", "''") & "'" & " AND "
If Not IsMissing(vstrAddress) Then strSQL = strSQL & " Address = " & "'" &
Replace(vstrAddress, "'", "''") & "'" & " AND "
If Not IsMissing(vstrCity) Then strSQL = strSQL & " City = " & "'" &
Replace(vstrCity, "'", "''") & "'" & " AND "
If Not IsMissing(vstrCountry) Then strSQL = strSQL & " Country = " & "'" &
Replace(vstrCountry, "'", "''") & "'" & " AND "
If Not IsMissing(vstrPINCode) Then strSQL = strSQL & " PINCode = " & "'" &
Replace(vstrPINCode, "'", "''") & "'" & " AND "
If Not IsMissing(vstrPhone) Then strSQL = strSQL & " Phone = " & "'" &
Replace(vstrPhone, "'", "''") & "'" & " AND "
If Not IsMissing(vstrE_Mail) Then strSQL = strSQL & " E_Mail = " & "'" &
Replace(vstrE_Mail, "'", "''") & "'" & " AND "
If Not IsMissing(vstrCompanyID) Then strSQL = strSQL & " CompanyID = " & "'" &
Replace(vstrCompanyID, "'", "''") & "'" & " AND "
If Not IsMissing(vstrEmp_Cat) Then strSQL = strSQL & " Emp_Cat = " & "'" &
Replace(vstrEmp_Cat, "'", "''") & "'" & " AND "
If Not IsMissing(vstrLogin_Name) Then strSQL = strSQL & " Login_Name = " & "'" &
Replace(vstrLogin_Name, "'", "''") & "'" & " AND "
If Not IsMissing(vstrLogin_Pwd) Then strSQL = strSQL & " Login_Pwd = " & "'" &
Replace(vstrLogin_Pwd, "'", "''") & "'" & " AND "
If Not IsMissing(vstrULoginStatus) Then strSQL = strSQL & " ULoginStatus = " & "'" &
Replace(vstrULoginStatus, "'", "''") & "'" & " AND "
If Not IsMissing(vdteActivation_Dt) Then strSQL = strSQL & " Activation_Dt = " & "'"
& vdteActivation_Dt & "'" & " AND "
If Not IsMissing(vstrCreatedBy) Then strSQL = strSQL & " CreatedBy = " & "'" &
Replace(vstrCreatedBy, "'", "''") & "'" & " AND "
If Not IsMissing(vstrState) Then strSQL = strSQL & " State = " & "'" &
Replace(vstrState, "'", "''") & "'" & " AND "
If Not IsMissing(vstrStatus) Then strSQL = strSQL & " Status = " & "'" &
Replace(vstrStatus, "'", "''") & "'" & " AND "
If Not IsMissing(vstrLogin_Mc_Ip) Then strSQL = strSQL & " Login_Mc_Ip = " & "'" &
Replace(vstrLogin_Mc_Ip, "'", "''") & "'" & " AND "
If Not IsMissing(vstrf10) Then strSQL = strSQL & " f10 = " & "'" & Replace(vstrf10,
"'", "''") & "'" & " AND "
'// Lose 'WHERE' clause and last 'AND' if not used
strSQL = Trim(strSQL)
If Right(strSQL, 5) = "WHERE" Then strSQL = Left(strSQL, Len(strSQL) - 5)
If Right(strSQL, 3) = "AND" Then strSQL = Left(strSQL, Len(strSQL) - 3)
'// Ensure recordset uses an 'adClient' cursor
rs.CursorLocation = adUseClient
'// Open the database
Set cn = New ADODB.Connection
cn.ConnectionString = CONNECT_STRING
cn.Open
'// Open recordset
rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly
'// Detach cursor from database connection
Set rs.ActiveConnection = Nothing
'// Return the recordset
Set GetAll = rs
'// Cleanup
Set rs = Nothing
cn.Close
Set cn = Nothing
'// Commit to MTS
If Not mobjCtx Is Nothing Then mobjCtx.SetComplete
GetAll_Done:
Exit Function GetAll_Error:
'// Abort MTS changes
If Not mobjCtx Is Nothing Then mobjCtx.SetAbort
Call Process_Error(MODULE_NAME, "GetAll")
Resume GetAll_Done End Function
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]