DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 12 Jul 2007 06:10:44 -0700,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    Tom Pester
          2    William \(Bill\) Vaughn
                 3    Jim Rand


How to make Raiserror report to ado.net   
Hi group,

I have put some validation logic in a trigger and when it doesn't
validate I do a rollback + raiserror.

So for so good but how do I detect this in ADO.NET ?

Is there a way to use raiserror or some othe mechanism to communicate
to ado.net/asp.net that someting went wrong? Currently if I do an
insert and it doesn't validate the ASP.NET site still thinks everyting
is fine.
Date:Thu, 12 Jul 2007 06:10:44 -0700   Author:  

Re: How to make Raiserror report to ado.net   
InfoMessage Event.

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Tom Pester"  wrote in message 
news:1184245844.930548.278210@n2g2000hse.googlegroups.com...

> Hi group,
>
> I have put some validation logic in a trigger and when it doesn't
> validate I do a rollback + raiserror.
>
> So for so good but how do I detect this in ADO.NET ?
>
> Is there a way to use raiserror or some othe mechanism to communicate
> to ado.net/asp.net that someting went wrong? Currently if I do an
> insert and it doesn't validate the ASP.NET site still thinks everyting
> is fine.
> 
Date:Thu, 12 Jul 2007 10:00:57 -0700   Author:  

Re: How to make Raiserror report to ado.net   
BEGIN TRANSACTION;

 -- Authorized rep - can't delete
 DECLARE @OfficeCount INT;
  SET @OfficeCount = (SELECT COUNT(AgencyNET.Office.OfficeID)
                        FROM AgencyNET.Office INNER JOIN
                         AgencyNET.StatusLookup ON 
AgencyNET.Office.StatusLookupID = AgencyNET.StatusLookup.StatusLookupID
                       WHERE (NOT (AgencyNET.StatusLookup.Status IN 
('Expelled', 'Terminated')))
                         AND (AgencyNET.Office.AREndUserID = @EnduserID));
 IF @OfficeCount >= 1
  BEGIN
   RAISERROR ('Business Logic:Authorized Representative: Can''t delete 
enduser', 14, 1);
   COMMIT TRANSACTION;
   RETURN 0;
  END;


------------------------------------------------
   catch (System.Data.SqlClient.SqlException ex)
   {
    if (catchAndRefill)
    {
     if (Regex.Match(ex.Message, "^Business Logic:").Success)
     {
      MessageBox.Show(ex.Message.Substring(15), "Business Logic 
Validation");
      Fill(ds, adapterList);
      throw new Helpers.CheckDeletesException(ex.Message.Substring(15));
     }
     else
     {
      _log.Error("DataAccessLayer.Update: Unexpected exception", ex);
      throw new Exception("", ex);
     }
    }
    else
    {
     _log.Error("DataAccessLayer.Update: Unexpected exception", ex);
     throw new Exception("", ex);
    }
   }

"William (Bill) Vaughn"  wrote in message 
news:Ocn$3YKxHHA.4612@TK2MSFTNGP04.phx.gbl...

> InfoMessage Event.
>
> -- 
> ____________________________________
> William (Bill) Vaughn
> Author, Mentor, Consultant
> Microsoft MVP
> INETA Speaker
> www.betav.com/blog/billva
> www.betav.com
> Please reply only to the newsgroup so that others can benefit.
> This posting is provided "AS IS" with no warranties, and confers no 
> rights.
> __________________________________
> Visit www.hitchhikerguides.net to get more information on my latest book:
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
> -----------------------------------------------------------------------------------------------------------------------
>
> "Tom Pester"  wrote in message 
> news:1184245844.930548.278210@n2g2000hse.googlegroups.com...
>> Hi group,
>>
>> I have put some validation logic in a trigger and when it doesn't
>> validate I do a rollback + raiserror.
>>
>> So for so good but how do I detect this in ADO.NET ?
>>
>> Is there a way to use raiserror or some othe mechanism to communicate
>> to ado.net/asp.net that someting went wrong? Currently if I do an
>> insert and it doesn't validate the ASP.NET site still thinks everyting
>> is fine.
>>
>
> 
Date:Thu, 12 Jul 2007 13:58:05 -0400   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us