Hi

I am updating a datatable in a dataset as below;

daMyAdpater.Update(MyDataSet.MyTable)

How can I trap various different exceptions that may occur during this
update process?

Thanks

Regards

Re: Trapping data update exceptions by Cor

Cor
Sat Mar 15 06:57:32 CDT 2008

Try
daMyAdpater.Update(MyDataSet.MyTable)
catch sqlex as SqlException
messagebox.show(sqlex.ToString)
'fixing any SQLTransact code problem
catch ex as Exception
messagebox.show(ex.ToString0
finally
messagebox.show("This will done always as long as you do not power off")
end Try

There is a thirth one you can use, but I never do that.

Cor

"John" <John@nospam.infovis.co.uk> schreef in bericht
news:e%23qWJRkhIHA.5204@TK2MSFTNGP02.phx.gbl...
> Hi
>
> I am updating a datatable in a dataset as below;
>
> daMyAdpater.Update(MyDataSet.MyTable)
>
> How can I trap various different exceptions that may occur during this
> update process?
>
> Thanks
>
> Regards
>


Re: Trapping data update exceptions by John

John
Sat Mar 15 13:45:45 CDT 2008

Hi Cor

Many thanks.

1. Will sqlex.ToString also show Source, Target Site, DataRow and StackTrace
or do I need to show these individually.

2. Would this also trap concurrency violations or do I also need to trap for
DBConcurrencyException? Very sheepishly I want to add I am using Access
backend instead of SQL Server. I am hoping to upgrade to SQL Server soon in
next phase.

Thanks again.

Regards


"Cor Ligthert[MVP]" <notmyfirstname@planet.nl> wrote in message
news:B92AE85A-5D39-49C4-BADE-379776250AD1@microsoft.com...
> Try
> daMyAdpater.Update(MyDataSet.MyTable)
> catch sqlex as SqlException
> messagebox.show(sqlex.ToString)
> 'fixing any SQLTransact code problem
> catch ex as Exception
> messagebox.show(ex.ToString0
> finally
> messagebox.show("This will done always as long as you do not power
> off")
> end Try
>
> There is a thirth one you can use, but I never do that.
>
> Cor
>
> "John" <John@nospam.infovis.co.uk> schreef in bericht
> news:e%23qWJRkhIHA.5204@TK2MSFTNGP02.phx.gbl...
>> Hi
>>
>> I am updating a datatable in a dataset as below;
>>
>> daMyAdpater.Update(MyDataSet.MyTable)
>>
>> How can I trap various different exceptions that may occur during this
>> update process?
>>
>> Thanks
>>
>> Regards
>>
>



Re: Trapping data update exceptions by Cor

Cor
Sun Mar 16 05:54:21 CDT 2008

John,

John,

Have a look at this one, that is the equivalent of the SQLException

http://msdn2.microsoft.com/en-us/library/system.data.oledb.oledbexception(vs.71).aspx

Cor




The concurrency vialotions come in your ex because there is nothing wrong
with
"John" <John@nospam.infovis.co.uk> schreef in bericht
news:%23oamDzshIHA.5824@TK2MSFTNGP03.phx.gbl...
> Hi Cor
>
> Many thanks.
>
> 1. Will sqlex.ToString also show Source, Target Site, DataRow and
> StackTrace or do I need to show these individually.
>
> 2. Would this also trap concurrency violations or do I also need to trap
> for DBConcurrencyException? Very sheepishly I want to add I am using
> Access backend instead of SQL Server. I am hoping to upgrade to SQL Server
> soon in next phase.
>
> Thanks again.
>
> Regards
>
>
> "Cor Ligthert[MVP]" <notmyfirstname@planet.nl> wrote in message
> news:B92AE85A-5D39-49C4-BADE-379776250AD1@microsoft.com...
>> Try
>> daMyAdpater.Update(MyDataSet.MyTable)
>> catch sqlex as SqlException
>> messagebox.show(sqlex.ToString)
>> 'fixing any SQLTransact code problem
>> catch ex as Exception
>> messagebox.show(ex.ToString0
>> finally
>> messagebox.show("This will done always as long as you do not power
>> off")
>> end Try
>>
>> There is a thirth one you can use, but I never do that.
>>
>> Cor
>>
>> "John" <John@nospam.infovis.co.uk> schreef in bericht
>> news:e%23qWJRkhIHA.5204@TK2MSFTNGP02.phx.gbl...
>>> Hi
>>>
>>> I am updating a datatable in a dataset as below;
>>>
>>> daMyAdpater.Update(MyDataSet.MyTable)
>>>
>>> How can I trap various different exceptions that may occur during this
>>> update process?
>>>
>>> Thanks
>>>
>>> Regards
>>>
>>
>
>