SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2010
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    type mismatch calling subroutine

    the sub:
    Sub setGrpObj (lvl, gid, str)
    str = REPLACE(str," ","")
    lstStr = SPLIT(str,",")
    for each o in lstStr
    set cn = Server.CreateObject("ADODB.Connection")
    cn.Open connStr
    sqlStr = "INSERT INTO secGroupObjects(intGroupId, intObjectId, intPermTypeId) "
    sqlStr = sqlStr & "VALUES(" & gid & "," & o & ", " & lvl & ")"
    set rs = Server.CreateObject("ADODB.RecordSet")
    set rs = cn.Execute(sqlStr)
    cn.close
    set rs = nothing
    set cn = nothing
    next
    end Sub

    The call:
    setGroupObj 2, request("intGroupId"), request("editallchk")

    The Problem:
    Type mismatch: 'setGroupObj'

    Anyone see where I'm going wrong???

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Call setGroupObj 2, request("intGroupId"), request("editallchk")

    ??

    And, I'd suggest you move the Set cn and open/close lines outside of the for loop.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why are you creating a recordset when inserting values ?

    try:

    Code ASP:
    ...
    sqlStr = "INSERT INTO secGroupObjects(intGroupId, intObjectId, intPermTypeId) "
    sqlStr = sqlStr & "VALUES(" & gid & "," & o & ", " & lvl & ")"
    cn.Execute(sqlStr)
    ...

    Also I believe you need parentheses when using the explicit "Call"

    Call setGroupObj (2, request("intGroupId"), request("editallchk") )


Bookmarks

Posting Permissions

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