asp.net 读取文本文件并插入数据库的实现代码
2024-07-10 12:42:16
供稿:网友
由此,需要操作以下几个步骤
1,上传txt文件至公司系统
2,读取需要的内容
3,将内容插入到数据库中(需要判断重复)
4,与现有订单数据进行对比
本程序只研究读取需要的内容和插入数据库
代码如下:
using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using service.DAL;
using System.Reflection;
namespace service.fin
{
[Serializable]
public class SettlementCmbModel
{
public SettlementCmbModel() { }
#region Model
private int _id;
private string _terminalno;
private DateTime? _tradetime;
private string _batchno;
private string _channel;
private string _empowerno;
private string _orderno;
private string _cardno;
private string _cardmark;
private string _tradetype;
private string _businesstype;
private string _goodsno;
private string _stages;
private decimal? _tradeamount;
private decimal? _commissionamount;
private decimal? _returnfee;
private decimal? _memberspoint1;
private decimal? _memberspoint2;
private decimal? _mpcmbpercent;
private decimal? _mpvalue;
private decimal? _realamount;
/// <summary>
///
/// </summary>
public int Id
{
set { _id = value; }
get { return _id; }
}
/// <summary>
///
/// </summary>
public string TerminalNo
{
set { _terminalno = value; }
get { return _terminalno; }
}
/// <summary>
///
/// </summary>
public DateTime? TradeTime
{
set { _tradetime = value; }
get { return _tradetime; }
}
/// <summary>
///
/// </summary>
public string BatchNo
{
set { _batchno = value; }
get { return _batchno; }
}
/// <summary>
///
/// </summary>
public string Channel
{
set { _channel = value; }
get { return _channel; }
}
/// <summary>
///
/// </summary>
public string EmpowerNo
{
set { _empowerno = value; }
get { return _empowerno; }
}
/// <summary>
///
/// </summary>
public string OrderNo
{
set { _orderno = value; }
get { return _orderno; }
}
/// <summary>
///
/// </summary>
public string CardNo
{
set { _cardno = value; }
get { return _cardno; }
}
/// <summary>
///
/// </summary>
public string CardMark
{
set { _cardmark = value; }
get { return _cardmark; }
}
/// <summary>
///
/// </summary>
public string TradeType
{
set { _tradetype = value; }
get { return _tradetype; }
}
/// <summary>
///
/// </summary>
public string BusinessType
{
set { _businesstype = value; }