void initSQLTable(ProcSql proc) { DataTable inTable = SQLFunction.GetResultTable(proc.InTable); DataRow[] sqlRows = new DataRow[ResTable.Rows.Count]; DataRowCollection resRows = ResTable.Rows; for (int i = 0; i < resRows.Count; i++) { DataRow newRow = inTable.Rows.Add(); foreach (KeyValuePair <string, string> field in proc.inFields) { switch (field.Key.ToLower()) { case "ip": newRow[field.Key] = Scan.GetLocalIPByte(); break; case "row_id": newRow[field.Key] = i; break; default: newRow[field.Key] = resRows[i][field.Value]; break; } } sqlRows[i] = newRow; } SQLFunction.ExecuteNonQuery( String.Format("delete from {0} where IP = 0x{1}", proc.InTable, Scan.GetLocalIPAddress(true)) ); SQLFunction.BulkWrite(proc.InTable, sqlRows); }
public ParamSys(string paramName, string outName, FieldFunc ownField) : base(paramName, outName, ownField) { Service = true; if (!Enum.IsDefined(typeof(serviseFields), outName)) { Error = String.Format("not a system field", outName); } else { XlsExist = true; if (outName == serviseFields.IP.ToString()) { SysValue = Scan.GetLocalIPByte(); strValue = Scan.GetLocalIPAddress(true); } } }