HI
I would Like to Know how can Display the error Message When Executing the SP ..
and the Stored Procedure doesn't having any value to Fire the Event ..
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
-- =============================================
-- Author: <sabari,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER procedure [dbo].[USP_Delete](
@name varchar(100)
)
as
begin
begin try
begin transaction
delete from custo where name=@name
commit transaction
end try
begin catch
rollback transaction
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,
ERROR_MESSAGE() AS ErrorMessage;
end catch
end
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using TMSCOMMON;
namespace TMSCOMMON
{
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
BLayer objblayer = new BLayer();
DataTable dt = new DataTable();
dt = objblayer.Delrecd(TextBox1.Text);
int success = dt.Rows.Count;
if (success != 0)
{
lblerror.Text = "Delete Suc";
}
}
}
}
in the above code will work only if the Data has passed is valid and in the DB if anything match with that is doing "Deletion" .... certainly we checked with empty strings and it returns the Same Message so I would like to Show the Error that User "entered a empty String"!!!
if it enters empty and trigger the button>> Want to Show in ASP.Net Forms