修改导出
This commit is contained in:
parent
de141de3bd
commit
d2697baf37
@ -1,18 +1,13 @@
|
|||||||
using MySqlConnector;
|
using Chenfeng.MES.Archiver.Core;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Dapper;
|
|
||||||
using CliFx;
|
|
||||||
using CliFx.Infrastructure;
|
|
||||||
using CliFx.Attributes;
|
|
||||||
using System.Data;
|
|
||||||
using System.Data.Common;
|
|
||||||
using Chenfeng.MES.Archiver.Core;
|
|
||||||
using Chenfeng.MES.Archiver.Data;
|
using Chenfeng.MES.Archiver.Data;
|
||||||
|
using CliFx;
|
||||||
|
using CliFx.Attributes;
|
||||||
|
using CliFx.Infrastructure;
|
||||||
|
using Dapper;
|
||||||
|
using MySqlConnector;
|
||||||
|
using System.Data;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Chenfeng.MES.Archiver.Commands
|
namespace Chenfeng.MES.Archiver.Commands
|
||||||
{
|
{
|
||||||
@ -164,7 +159,7 @@ namespace Chenfeng.MES.Archiver.Commands
|
|||||||
for (int i = 0; i < reader.FieldCount; i++)
|
for (int i = 0; i < reader.FieldCount; i++)
|
||||||
{
|
{
|
||||||
//columns.Add(reader.GetName(i));
|
//columns.Add(reader.GetName(i));
|
||||||
columnString.Append($"`reader.GetName(i)`,");
|
columnString.Append($"`{reader.GetName(i)}`,");
|
||||||
}
|
}
|
||||||
columnString.Length--;
|
columnString.Length--;
|
||||||
}
|
}
|
||||||
@ -175,13 +170,17 @@ namespace Chenfeng.MES.Archiver.Commands
|
|||||||
for (int i = 0; i < reader.FieldCount; i++)
|
for (int i = 0; i < reader.FieldCount; i++)
|
||||||
{
|
{
|
||||||
var val = reader.GetValue(i);
|
var val = reader.GetValue(i);
|
||||||
|
|
||||||
switch (val)
|
switch (val)
|
||||||
{
|
{
|
||||||
|
case bool b:
|
||||||
|
row.Add(b ? 1 : 0);
|
||||||
|
break;
|
||||||
case string s:
|
case string s:
|
||||||
row.Add($"'{s}'");
|
row.Add($"'{s}'");
|
||||||
break;
|
break;
|
||||||
case DateTime dt:
|
case DateTime dt:
|
||||||
row.Add(dt.ToString("'yyyy-MM-dd HH:mm:ss'"));
|
row.Add('\'' + dt.ToString("yyyy-MM-dd HH:mm:ss") + '\'');
|
||||||
break;
|
break;
|
||||||
case byte[] byteList:
|
case byte[] byteList:
|
||||||
row.Add("0x" + string.Concat(byteList.Select(i => i.ToString("X2"))));
|
row.Add("0x" + string.Concat(byteList.Select(i => i.ToString("X2"))));
|
||||||
|
Loading…
Reference in New Issue
Block a user