BlockIPAddr/Program.cs

27 lines
678 B
C#
Raw Normal View History

2025-06-30 03:56:30 -04:00
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);
}
}
}
}