码迷,mamicode.com
首页 > Windows程序 > 详细

C#数据上传方法

时间:2016-03-28 14:59:33      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:

     /// <summary>
        /// 连接成功后开始调用数据上传程序
        /// </summary>
        public void CallDataUpload()
        {
            //指定上传日期后,只上传指定日期的数据
            //取指定的上传日期
            string defineScrq = GetDefineScrq();
            if (defineScrq != "")
            {
                scrq = Convert.ToDateTime(defineScrq);
                CreateUploadFile();
                return;
            }

            //取本地的上传站点
            DBhelper.connectionString = GetconnectionString("OracleConn");
            string sczd = GetSczd();
            //设置连接串
            DBhelper.connectionString = GetconnectionString("DestinationConn");//ConfigurationManager.AppSettings["DestinationConn"];
            string count = "select count(*) from T90_UPLOADREGISTER where SCZD=‘" + sczd + "";
            if (DBhelper.GetScalar(count) == "0") //上传当天的数据
            {
                CreateUploadFile();
            }
            else //上传以前的数据
            {
                DBhelper.connectionString = GetconnectionString("DestinationConn");//ConfigurationManager.AppSettings["DestinationConn"];
                string sql = "select to_char(max(SCSJ),‘yyyy-mm-dd‘) from T90_UPLOADREGISTER where SCZD=‘" + sczd + "";
                lastTime = DBhelper.GetScalar(sql);//上次上传时间
                string thisTime = scrq.ToString("yyyy-MM-dd");//本次上传时间
                sql = "select to_date(‘" + thisTime + "‘,‘yyyy-mm-dd‘) - to_date(‘" + lastTime + "‘,‘yyyy-mm-dd‘) from dual";
                int ts = Convert.ToInt32(DBhelper.GetScalar(sql));//间隔天数
                scrq = Convert.ToDateTime(lastTime + " " + scrq.ToLongTimeString());
                for (int i = 0; i < ts; i++)
                {
                    scrq = scrq.AddDays(1);
                    CreateUploadFile();
                }
            }
        }

 

C#数据上传方法

标签:

原文地址:http://www.cnblogs.com/siyunianhua/p/5328764.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!