Results 1 to 2 of 2

Thread: Error Passing Disconnected Recordsert

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    india
    Posts
    109

    Error Passing Disconnected Recordsert

    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 respect love and lovers ,but it should be possesive .
    I love friendship and friends but it should be true.

  2. #2
    j2k
    Guest
    Wrong forum mate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width