标签:
/// <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(); } } }
标签:
原文地址:http://www.cnblogs.com/siyunianhua/p/5328764.html