anizmohammed
Feb 21st, 2002, 11:23 PM
Hi all ,
I am Passing a disconnected recordset to a MTS component
but my code raises the type mismatch error,
This is general error which will occur when u pass byref parameters with parentheses,
that i can clear ,but i want to get the boolean value whether
the action is succeeded or not back from the component,
so my function would look like the below code.
'component code
Public Function InsertUsers(RecSource As adodb.Recordset) As Boolean
On Error GoTo errhandle
Dim ctxObject As ObjectContext
Set ctxObject = GetObjectContext()
RecSource.ActiveConnection = "provider=sqloledb; data source=NTSERVER; Initial Catalog=4indiagarments; uid=aniz; pwd=hello;"
RecSource.UpdateBatch
Set RecSource = Nothing
ctxObject.SetComplete
InsertUsers = True
Exit Function
errhandle:
ctxObject.SetAbort
InsertUsers = False
Err.Raise vbObjectError, "MtsComponent.Insertusers", Err.Description
End Function
'inside VB works Fine
Set rs = RegisUser.GetUsersStructure
rs.AddNew
rs("username") = "kamal"
rs("password") = "prakash"
rs("question") = "hhello"
rs("answer") = "hello"
rs("email") = "hai"
rs("firstname") = "hello"
rs.Update
If RegisUser.InsertUsers(rs) = True Then
MsgBox "Succeeded"
Set rs = Nothing
Else
MsgBox "Failed"
End If
'inside ASP shows Type Mismatch Error
dim RegisUserVar
set RegisUserVar=server.CreateObject ("Mts_4indiagarments.RegisUser")
if RegisUserVar.UserAlreadyExists(cstr(strusername))=false then
set rs=server.CreateObject ("adodb.recordset")
set rs=RegisUserVar.GetUsersStructure
rs.addnew
rs("username")=strusername
rs("password")=strpassword
rs("question")=strquestion
rs("answer")=stranswer
rs("email")=stremail
rs("firstname")=strfn
rs.Update
rs.close
if RegisUserVar.InsertUsers(rs) = True Then 'error in this line
set rs=nothing
strError = "Success"
'Forward the user to page to notify of authentication
End If
end if
'The thing Is I dont Want To change my components code.
Any good suggestion,please
Thank You
Aniz
I am Passing a disconnected recordset to a MTS component
but my code raises the type mismatch error,
This is general error which will occur when u pass byref parameters with parentheses,
that i can clear ,but i want to get the boolean value whether
the action is succeeded or not back from the component,
so my function would look like the below code.
'component code
Public Function InsertUsers(RecSource As adodb.Recordset) As Boolean
On Error GoTo errhandle
Dim ctxObject As ObjectContext
Set ctxObject = GetObjectContext()
RecSource.ActiveConnection = "provider=sqloledb; data source=NTSERVER; Initial Catalog=4indiagarments; uid=aniz; pwd=hello;"
RecSource.UpdateBatch
Set RecSource = Nothing
ctxObject.SetComplete
InsertUsers = True
Exit Function
errhandle:
ctxObject.SetAbort
InsertUsers = False
Err.Raise vbObjectError, "MtsComponent.Insertusers", Err.Description
End Function
'inside VB works Fine
Set rs = RegisUser.GetUsersStructure
rs.AddNew
rs("username") = "kamal"
rs("password") = "prakash"
rs("question") = "hhello"
rs("answer") = "hello"
rs("email") = "hai"
rs("firstname") = "hello"
rs.Update
If RegisUser.InsertUsers(rs) = True Then
MsgBox "Succeeded"
Set rs = Nothing
Else
MsgBox "Failed"
End If
'inside ASP shows Type Mismatch Error
dim RegisUserVar
set RegisUserVar=server.CreateObject ("Mts_4indiagarments.RegisUser")
if RegisUserVar.UserAlreadyExists(cstr(strusername))=false then
set rs=server.CreateObject ("adodb.recordset")
set rs=RegisUserVar.GetUsersStructure
rs.addnew
rs("username")=strusername
rs("password")=strpassword
rs("question")=strquestion
rs("answer")=stranswer
rs("email")=stremail
rs("firstname")=strfn
rs.Update
rs.close
if RegisUserVar.InsertUsers(rs) = True Then 'error in this line
set rs=nothing
strError = "Success"
'Forward the user to page to notify of authentication
End If
end if
'The thing Is I dont Want To change my components code.
Any good suggestion,please
Thank You
Aniz