// Create an instance of the server string connectionString = "...Connection String..."; SqlConnection connection = new SqlConnection(connectionString); Server server = new Server(new ServerConnection(connection)); // I want to add the stored procedure to the "MyDatabase" Database Database db = server.Databases["MyDatabase"]; // Create a Stored Procedure called "GetClubByID" in "MyDatabase" StoredProcedure mySP = new StoredProcedure(db, "GetClubByID"); mySP.TextMode = false; mySP.AnsiNullsStatus = false; mySP.QuotedIdentifierStatus = false; // GetClubByID requires the ID of the Club as an Input Parameter StoredProcedureParameter idParam = new StoredProcedureParameter(mySP, "@ID", DataType.Int); mySP.Parameters.Add(idParam); // The SQL Text mySP.TextBody = "Select [ID], [Title] FROM [Club] WHERE [ID] = @ID"; // Create the stored procedure in the database mySP.Create(); |