27 lines
678 B
C#
27 lines
678 B
C#
|
using Microsoft.Data.SqlClient;
|
|||
|
|
|||
|
namespace BlockIPAddr;
|
|||
|
|
|||
|
internal class Program
|
|||
|
{
|
|||
|
static void Main(string[] args)
|
|||
|
{
|
|||
|
using (var cn = new SqlConnection(kmCommonLibsCore.Constants.cnPortal))
|
|||
|
using (var cm = new SqlCommand("dbo.[BlockIPAddrInFirewall]", cn) { CommandType = System.Data.CommandType.StoredProcedure })
|
|||
|
{
|
|||
|
Console.WriteLine();
|
|||
|
cn.Open();
|
|||
|
cm.Parameters.Add("@ip4", System.Data.SqlDbType.VarChar, 30);
|
|||
|
foreach (string arg in args)
|
|||
|
{
|
|||
|
string rv;
|
|||
|
|
|||
|
cm.Parameters["@ip4"].Value = arg.Trim();
|
|||
|
rv = Convert.ToString(cm.ExecuteScalar() ?? string.Empty);
|
|||
|
|
|||
|
Console.WriteLine(rv);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|