ALTER PROCEDURE [dbo].[addcountry](@cname varchar(50))
as
IF EXISTS (Select 1 from country where countryname = @cname)
BEGIN
/* SET NOCOUNT ON */
RETURN 'Record already exist'
END
ELSE
BEGIN
insert into country (countryname) values (@cname)
RETURN 'SUCCESS'
END
I want to return a message of record existing from the sql, how could i change the SP?
& how much i have to change my code to receive the message
public string onlyaddcountry(string CountryName)//add country in Default page
{
try
{
string Connection = System.Configuration.ConfigurationManager.ConnectionStrings["ClientInfoConnectionString1"].ConnectionString;
SqlConnection con2 = new SqlConnection(Connection);
if (con2.State == ConnectionState.Open)
{
con2.Close( ...
Go to the complete details ...