Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Value of type 'String' cannot be converted to '1-dimensional array of System.Object'

Reply
Thread Tools

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

 
 
=?Utf-8?B?U2Vhbg==?=
Guest
Posts: n/a
 
      02-06-2004
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
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U2Vhbg==?=
Guest
Posts: n/a
 
      02-06-2004
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

 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      02-06-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Value of type Decimal cannot be converted to 1 dimensional array of Decimal Neal Software 0 03-20-2011 03:08 AM
value of type "MyNamespace.MyClassName" cannot be converted to "MyNamespace.MyClassName" Bert Leu ASP .Net 1 06-09-2007 06:33 PM
value of type "xxx" cannot be converted to "xxx" Bert Leu ASP .Net Web Services 2 06-06-2007 09:57 PM
Object of type 'System.String' cannot be converted to type 'System Robert ASP .Net Building Controls 5 04-20-2006 09:00 AM
value of type "MyNamespace.MyClassName" cannot be converted to "MyNamespace.MyClassName" Mike Schnorr ASP .Net 0 06-25-2004 12:17 PM



Advertisments