Пример #1
0
 private static void BindFile(FileInfo _file, SqlDataRecord record)
 {
     record.SetSqlDateTime(0, _file.Exists ? _file.CreationTime : SqlDateTime.Null);
     record.SetSqlDateTime(1, _file.Exists ? _file.LastAccessTime : SqlDateTime.Null);
     record.SetSqlDateTime(2, _file.Exists ? _file.LastWriteTime : SqlDateTime.Null);
     record.SetSqlBoolean(3, _file.Exists);
     record.SetString(4, _file.Name);
     record.SetString(5, _file.DirectoryName);
     record.SetString(6, _file.Extension);
     record.SetSqlInt64(7, _file.Exists ? _file.Length : SqlInt64.Null);
 }
Пример #2
0
    private static SqlDataRecord buildRecord(SqlMetaData[] metadata,EventLogEntry entry)
    {
        SqlDataRecord record     = new SqlDataRecord(metadata);

        record.SetSqlInt32(0, entry.Index);
        record.SetSqlInt64(1, entry.InstanceId);
        record.SetSqlDateTime(2, entry.TimeWritten);
        record.SetSqlString(3, entry.MachineName);
        record.SetSqlString(4, entry.Source);
        record.SetSqlString(5, entry.UserName);
        record.SetSqlString(6, entry.Message);

        return record;
    }