Пример #1
0
        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);
        }
Пример #2
0
        public void bulkData()
        {
            int       rowCount    = xlsTable.Rows.Count;
            DataTable sourceTable = xlsTable.Copy();

//            sourceTable.Columns.Remove("$ROW_ID");
            DataRow[] data = new DataRow[rowCount];
            for (int i = 0; i < rowCount; i++)
            {
                data[i] = sourceTable.Rows[i];
            }
//            MessageBox.Show(tabl.Rows.Count.ToString());
            SQLFunction.BulkWrite($"{tableName}", data, conn);
        }
Пример #3
0
 private static void writeToSql(DataTable resultTable, string xlsPach, DataTable table, string[] fields)
 {
     DataRow[] rows = new DataRow[table.Rows.Count];
     for (int count = 0; count < table.Rows.Count; count++)
     {
         DataRow newRow = resultTable.NewRow();
         for (int iField = 0; iField < fields.Length; iField++)
         {
             if (fields[iField] != "")
             {
                 if (table.Rows[count][fields[iField]] != DBNull.Value)
                 {
                     newRow[iField] = table.Rows[count][fields[iField]].ToString();
                 }
             }
         }
         newRow["fname"] = xlsPach;
         newRow["id"]    = count;
         rows[count]     = newRow;
     }
     SQLFunction.BulkWrite("__ukrSib", rows);
 }
Пример #4
0
 public void InsertToServer()
 {
     SQLFunction.BulkWrite(SQLTableName, RowsSql);
 }