Man this sucks. It's always after I post a question I then answer it. You have to use the spNew.Refresh(). It believe it asks the SQL Server the current status of the stored proc. Then you are allowed to delete it with ease.
private void btnDestroy_Click(object sender, EventArgs e)
{
SqlConnection sqlConn = new SqlConnection("Connection String HERE");
Microsoft.SqlServer.Management.Common.ServerConnection serverConn = new Microsoft.SqlServer.Management.Common.ServerConnection(sqlConn);
Server svrSql = new Server(serverConn);
Database db = svrSql.Databases["DBTest"];
StoredProcedure spNew = new StoredProcedure(db, "StoredProc");
//HERE IS THE KEY!
spNew.Refresh();
spNew.Drop();
svrSql = null;
}
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
Offline 87 posts
since Apr 2006