﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Customize SQL error message for VB.NET App use / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 15:14:32 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Customize SQL error message for VB.NET App use</title><link>http://www.sqlservercentral.com/Forums/Topic1368969-338-1.aspx</link><description>Hi,In both SQL Server and VB.NET you have to use Try catch block.What ever error you grab in SQL Server catch box just Raised it with RAISERROR syntax.Now in VB.NET you can capture this and show or do what ever operation you want.</description><pubDate>Sun, 07 Oct 2012 12:27:35 GMT</pubDate><dc:creator>Rajat Jaiswal-337252</dc:creator></item><item><title>RE: Customize SQL error message for VB.NET App use</title><link>http://www.sqlservercentral.com/Forums/Topic1368969-338-1.aspx</link><description>Can you provide me with some link or any code if there is any?</description><pubDate>Fri, 05 Oct 2012 22:06:12 GMT</pubDate><dc:creator>crux1187</dc:creator></item><item><title>RE: Customize SQL error message for VB.NET App use</title><link>http://www.sqlservercentral.com/Forums/Topic1368969-338-1.aspx</link><description>[quote][b]crux1187 (10/5/2012)[/b][hr]I am wondering if there is a way to overwrite or customize the system error thrown by SQL server. For example error message 521,instead of the default message you could customize or overwrite it with your own version of text.What I wanted to achieve is to have my own error message displayed by a VB.NET App when SQL server throws an exception that there is a duplicate value in the table.[/quote]Of course there is. Use Try-Catch in your VB app. Do you have a data layer? That would be the best place to capture this. All you need to do it catch the error and throw your own exception with your custom message.</description><pubDate>Fri, 05 Oct 2012 08:03:00 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>Customize SQL error message for VB.NET App use</title><link>http://www.sqlservercentral.com/Forums/Topic1368969-338-1.aspx</link><description>I am wondering if there is a way to overwrite or customize the system error thrown by SQL server. For example error message 521,instead of the default message you could customize or overwrite it with your own version of text.What I wanted to achieve is to have my own error message displayed by a VB.NET App when SQL server throws an exception that there is a duplicate value in the table.</description><pubDate>Fri, 05 Oct 2012 06:12:35 GMT</pubDate><dc:creator>crux1187</dc:creator></item></channel></rss>