Results 1 to 7 of 7

Thread: What is the wrong in this code?

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    SAUDI ARABIA
    Posts
    53

    What is the wrong in this code?

    I use this code in a class to insert row in table:-

    '********************
    Public Sub hosptINSERT(FRM As Object, C As Object)

    Set Cmd = New ADODB.Command
    With Cmd
    .ActiveConnection = cn
    .CommandText = "prd_insert_HOSPT"
    .CommandType = adCmdStoredProc
    .Parameters.Append .CreateParameter("@HOSPNAME_1", adVarChar, 1, 10, C(0).Text)
    .Parameters.Append .CreateParameter("@FULLNAME_2 ", adVarChar, 1, 50, C(1).Text)
    .Parameters.Append .CreateParameter("@AHOSPNAME_3", adVarChar, 1, 50, C(2).Text)
    End With
    End Sub
    '********************
    WHEN I TRAY TO RUN IT ,I FACE THES MSG:-'Must specify index for object array'
    never i can not say 'NO' for u until u aske me to leave u...

  2. #2
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    which line does Debug give the error on?
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  3. #3
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    you don't say what "cn" is. Is it an object array?

  4. #4

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    SAUDI ARABIA
    Posts
    53
    The object array is c(0),c(1) and c(3)
    never i can not say 'NO' for u until u aske me to leave u...

  5. #5
    Frenzied Member Blobby's Avatar
    Join Date
    Oct 2001
    Location
    England
    Posts
    1,512
    0, 1 and 3??
    There are 3 types of people in this world.........those that can count, and those that can't.

    Blobby

  6. #6

    Thread Starter
    Member
    Join Date
    Jan 2002
    Location
    SAUDI ARABIA
    Posts
    53
    So what can i do? How can i solve it? i need it to work in a class.
    never i can not say 'NO' for u until u aske me to leave u...

  7. #7
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    What is your code when you call this "hosptINSERT" sub?

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