Stored Proc to delete information

HawaiiDragon
HawaiiDragon used Ask the Experts™
on
Hello, I am trying to delete info from a database but for some reason I cant get it to work I checked the proc in SQL and it works great but not in VS2010 This is in C#


SQL
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[P_sp_RemoveAdminUser]
	/*
Uploaded Documents and information on Grade Appeal
	*/

@ParkID nvarchar (50),
@FirstName nvarchar (50),
@LastName nvarchar (50)




AS
Begin
Set nocount on;
Delete  from dbo.tbl_AdminUsers


Where
ParkID = @ParkID and
FirstName = @FirstName and
LastName = @LastName


end

Open in new window

C#
  protected void btnSubtractUser_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(Settings.GetConfigValue("PARK_GradeAppeal_v1", "GradeAppealSuperConnections"));
            con.Open();
            SqlCommand cmd = new SqlCommand("P_sp_RemoveAdminUser", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ParkID", TextBox1.Text);
            cmd.Parameters.AddWithValue("@FirstName", TextBox2.Text);
            cmd.Parameters.AddWithValue("@LastName", TextBox3.Text);
            cmd.ExecuteNonQuery();
            con.Close();
            populateUsers();
            Label3.Text = "User Deleted!!!";
            Label3.Visible = true;
        }

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
kaufmedGlanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
What is the error message?

Author

Commented:
no error message but no delte either...
Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015
Commented:
It seems to work fine for me when I copy your code to a new project. Are you sure you're not deleting from one database, but looking at another when you go to confirm?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial