The C-sharp database program tried to execute DROP LOGIN with Sqlcommand, but failed.

I want to use the Sqlcommand of C-sharp to execute DROP LOGIN (user) to delete the login account of SQL Server, but it seems that Sqlcommand cannot execute this statement.
I can successfully execute it under SQL Server management studio and console. Is there any way to achieve this function?

Mar.23,2021
Menu