Tag: 子网

在Excel电子表格中将variables与值匹配

我有一个代码,我input一个IP地址,我希望它find它的电子表格中的结束匹配的子网,我已经附上,有一个全面的子网。 基本上,将input的值在电子表格的单元格中find最接近的值并打印到控制台。 这里是我的代码,我注释了几行,所以我可以testing,如果电子表格链接正确。 Excel表格中只有2列。 A列和B列。细胞一直向下数千行。 using System; using System.Net; using Microsoft.Office.Interop.Excel; using Excel = Microsoft.Office.Interop.Excel; using System.Data.OleDb; using System.Data; using System.Runtime.InteropServices; namespace Investigations { class Program { static void Main(string[] args) { int rCnt = 0; int cCnt = 0; string str; IPAddress addr = IPAddress.Parse("8.8.8.8"); IPHostEntry entry = Dns.GetHostEntry(addr); Console.WriteLine("IP Address: " + addr); […]

如何匹配确切的string值或与Excel列单元格最接近的匹配

我有一个inputIP地址的代码,然后它将循环search该IP的excel列中最接近的匹配项。 它只是循环每一个IP,我怎么把它的论点匹配的IP? using System; using System.Net; using Microsoft.Office.Interop.Excel; using Excel = Microsoft.Office.Interop.Excel; using System.Data.OleDb; using System.Data; using System.Runtime.InteropServices; using System.Text.RegularExpressions; namespace Investigations { class Program { static void Main(string[] args) { IPAddress addr = IPAddress.Parse("8.8.8.8"); IPHostEntry entry = Dns.GetHostEntry(addr); Console.WriteLine("IP Address: " + addr); Console.WriteLine("Host Name: " + entry.HostName); Excel.Application xlApp = new Excel.Application(); Excel.Workbook […]

将string值匹配到导入的Excel电子表格中的值

我正在尝试input一个IP地址,将匹配我的Excel中的一个IP spreadhseet。 它开始崩溃在DataRow行= xlWorksheet.Rows [i]; 线。 我需要它循环,因为我正在处理数以千计的IP和子网,并且它需要匹配CLOSEST IP。 我在想这可能不会在电子表格中提取所有单元格? 因为input的IP地址是一个stringvariables,当我使用我注释的代码来显示所有列时,它将获得所有的列。 System; using System.Net; using Microsoft.Office.Interop.Excel; using Excel = Microsoft.Office.Interop.Excel; using System.Data.OleDb; using System.Data; using System.Runtime.InteropServices; using System.Text.RegularExpressions; namespace Investigations { class Program { static void Main(string[] args) { int rCnt = 0; int cCnt = 0; string str; IPAddress addr = IPAddress.Parse("8.8.8.8"); IPHostEntry entry = […]