-
February 13th, 2013, 01:47 PM
#1
[RESOLVED] code thinks deleted stored procedure still exists
Hello,
I'm writing some code to create stored procedures in a database. In order to test it out, I deleted a stored procedure (right clicking in
SQL Server 2008 and clicking on delete) and then ran my code to see if it would create it.
My code looks like this:
Code:
SqlCommand command = new SqlCommand();
SqlConnection conn = database.TypeLibraryDatabaseConnection;
command.Connection = conn;
// create the command to create the stored procedure
command.CommandText = database.GetProcedure(node.Name);
// create the stored proc in the database
try
{
command.ExecuteNonQuery();
}
catch
{
}
command.Dispose();
database.GetProcedure(node.name) basically gets a string containing the SQL script to create the stored procedure.
command.ExecuteNonQuery() throws an SqlException that says: "There is already an object named 'SecuritySession_DeleteSessionById' in the
database." But I deleted it! Why does it think it's still there?
Thanks for any help.
-
February 13th, 2013, 05:14 PM
#2
Re: code thinks deleted stored procedure still exists
How are you connecting to the database? By file? Connection string? Are you pointing to the same database in code as you are when you deleted the sproc?
-
February 15th, 2013, 10:13 AM
#3
Re: code thinks deleted stored procedure still exists
Turned out I was creating them in the wrong database. Problem solved.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|