Home All Groups Group Topic Archive Search About

No accessible overloaded 'DataRowCollection.Add' can be called without a narrowing conversion.

Author
10 Apr 2006 6:17 PM
Bill Nguyen
What do I need to do to add a row to a table with single column? I got the
"mnarrowing conversion" ewrror mesage.

Thanks



Bill

-----------------



Dim rValue(0) As Object

rValue(0) = CInt("1001")

dS.Tables(0).Rows.Add(rValue(0))

Error:
Additional information: No accessible overloaded 'DataRowCollection.Add' can
be called without a narrowing conversion.

Author
10 Apr 2006 6:29 PM
tlkerns
The Add method is expecting an Array of type Object, not one element of an
Array of type Object.

ds.Tables(0).Rows.Add(rValue)

should work.

Tony

Show quoteHide quote
"Bill Nguyen" wrote:

> What do I need to do to add a row to a table with single column? I got the
> "mnarrowing conversion" ewrror mesage.
>
> Thanks
>
>
>
> Bill
>
> -----------------
>
>
>
> Dim rValue(0) As Object
>
> rValue(0) = CInt("1001")
>
> dS.Tables(0).Rows.Add(rValue(0))
>
> Error:
> Additional information: No accessible overloaded 'DataRowCollection.Add' can
> be called without a narrowing conversion.
>
>
>
Author
10 Apr 2006 7:16 PM
Bill Nguyen
Thanks Tony;
This works well.
one more thing, can I sort the DS.Tables(0) after adding this new row?

Bill
Show quoteHide quote
"tlkerns" <tlke***@discussions.microsoft.com> wrote in message
news:3B91DB33-14DF-4E54-BB82-9280263E29C5@microsoft.com...
> The Add method is expecting an Array of type Object, not one element of an
> Array of type Object.
>
> ds.Tables(0).Rows.Add(rValue)
>
> should work.
>
> Tony
>
> "Bill Nguyen" wrote:
>
>> What do I need to do to add a row to a table with single column? I got
>> the
>> "mnarrowing conversion" ewrror mesage.
>>
>> Thanks
>>
>>
>>
>> Bill
>>
>> -----------------
>>
>>
>>
>> Dim rValue(0) As Object
>>
>> rValue(0) = CInt("1001")
>>
>> dS.Tables(0).Rows.Add(rValue(0))
>>
>> Error:
>> Additional information: No accessible overloaded 'DataRowCollection.Add'
>> can
>> be called without a narrowing conversion.
>>
>>
>>