Public feed
#723068
protected void AddGallery(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["Atomic_CMS"].ConnectionString);
SqlCommand cmd = new SqlCommand("sp_AddGallery", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Name", txtAddGallery.Text);
try
{
con.Open();
lblSuccess.Text = cmd.ExecuteScalar().ToString();
con.Close();
RadGrid1.DataBind();
}
catch (Exception ex)
{
lblSuccess.Text = "Error: " + ex.Message + " Please notify Atomic Design of this error. Please try again later.";
}
finally
{
con.Dispose();
}
}
ALTER PROCEDURE sp_AddGallery (
@Name nvarchar(250)
) AS
DECLARE @Success nvarchar(250)
IF NOT EXISTS (SELECT [Name] FROM Atomic_CMS_Photo_Galleries WHERE [Name] = @Name)
BEGIN
INSERT INTO Atomic_CMS_Photo_Galleries(Name)
VALUES(@Name)
SET @Success = '';
END
ELSE
BEGIN
SET @Success = 'Error: This Gallery Name is already in use. Please choose a different Name.';
END
SELECT @Success;