Bill McCarthy
4/26/2008 4:35:00 PM
Yeh, the difficulty though is with the TableAdapter. You'd could resort to
a late bound call (or reflection), otherwise the only thing I can think of
is partial classes for each adapter, adding an Interface that has Update
etc.
"Steve Gerrard" <mynamehere@comcast.net> wrote in message
news:_bydnWD6YNWjyo7VnZ2dnUVZ_tqtnZ2d@comcast.com...
> I'm not sure where the "tblClientsRow" came from, but theDataset.Tables is
> a collection of data tables. They are identified by the name used when
> they were added to the dataset, usually based on the source of the data,
> or a name assigned explicitly when the table was added.
>
> If you have a string table name, you can get at any table using
> theDataset.Tables("theTableName").
>
>
> John wrote:
>> Hi Bill
>>
>> Thanks. I'll take what I can get :)
>>
>> So Dataset.Tables("tblClientsRow") is the equivalent of tblClientsRow,
>> what is the "string" equivalents of
>> tblClientsTableAdapter and tblClients?
>> Many thanks again.
>>
>> Regards
>>
>> "Bill McCarthy" <Bill@N0SPAM.com> wrote in message
>> news:F74696A3-7F8F-4B46-B3D8-5505630C5E11@microsoft.com...
>>> Hi John,
>>>
>>> Probably not, at least not without significant changes. The problem
>>> you have is knowing the tblClients and tblClientsRow parts. You
>>> could use strings there, such as theDataset.Tables("tblClientsRow"),
>>> or alternatively you could use an interface but that would probably
>>> be just shifting the code writing around, not reducing or re-using
>>> that much . "John" <info@nospam.infovis.co.uk> wrote in message
>>> news:%23G1%238F0pIHA.2636@TK2MSFTNGP04.phx.gbl...
>>>> Hi
>>>>
>>>> I have below code which updates table tblClients and handles
>>>> concurrency violation if needed. Is there a way to make the code
>>>> generic so for example another table's name can be passed to the
>>>> SUB? Thanks
>>>>
>>>> Regards
>>>>
>>>>
>>>> Private Sub UpdateDatabase()
>>>>
>>>> Try
>>>> Me.tblClientsTableAdapter.Update(Me.ContactsDataSet.tblClients)
>>>>
>>>> Catch dbcx As Data.DBConcurrencyException
>>>> HanldeConcurrency(dbcx.Row, ContactsDataSet.tblClientsRow)
>>>>
>>>> End Try
>>>>
>>>> End Sub
>
>