Value of type 'String' cannot be converted to '1-dimensional array of System.Object'

Discussion in 'ASP .Net' started by =?Utf-8?B?U2Vhbg==?=, Feb 6, 2004.

  1. Hello,

    I have a function in C# that accepts a stored proc name and an array of parameters, and then returns a dataset, which works just fine.
    I have converted the function to VB:

    Public Shared Function GetDataSet(ByVal storedProcedure As String, ByRef parameterArray As Object()) As DataSet
    =?Utf-8?B?U2Vhbg==?=, Feb 6, 2004
    #1
    1. Advertising

  2. I think I have it

    I was missing the ParamArray keyword

    Public Shared Function GetDataSet(ByVal storedProcedure As String, ByVal ParamArray parameterArray As Object()) As DataSe



    End Functio
    =?Utf-8?B?U2Vhbg==?=, Feb 6, 2004
    #2
    1. Advertising

  3. You have typed your TWO input parameters as (1) String, and (2)
    1-Dimensional array of Object.

    You're calling the function and passing THREE parameters to it: (1) String,
    (2) String, and (3) Number.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "Sean" <> wrote in message
    news:...
    > Hello,
    >
    > I have a function in C# that accepts a stored proc name and an array of

    parameters, and then returns a dataset, which works just fine.
    > I have converted the function to VB:
    >
    > Public Shared Function GetDataSet(ByVal storedProcedure As String,

    ByRef parameterArray As Object()) As DataSet
    > .
    > .
    > .
    > End Function
    >
    > But when I call:
    >
    > GetDataSet("procGetSearchResult", "@param1", 1)
    >
    > I experience the following problem:
    >
    > Value of type 'String' cannot be converted to '1-dimensional array of

    System.Object'
    >
    > I know that String is a value type, but C# had no problem with this.
    > Why is VB complaining, and how can I fix this problem?
    >
    > TIA,
    >
    > - Sean.
    Kevin Spencer, Feb 6, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hessam
    Replies:
    0
    Views:
    2,178
    Hessam
    Aug 8, 2003
  2. Chun
    Replies:
    0
    Views:
    713
  3. Venkat
    Replies:
    4
    Views:
    972
    Venkat
    Dec 5, 2003
  4. Hessam
    Replies:
    1
    Views:
    231
    Teemu Keiski
    Aug 16, 2003
  5. Robert
    Replies:
    5
    Views:
    911
    阿利
    Apr 20, 2006
Loading...

Share This Page