本文介绍了如何在C#按钮单击时将精确数据从excel传输到Sql 2005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 此代码正常工作,但在许多列值为零时,在excel文件中的值不为零... 所以我如何在excel plz中插入corect值帮助我.. 谢谢... public void FindExcelData(string pathss,string sheetss) { chkProc = 0; OleDbConnection oconn = new OleDbConnection(@Provider = Microsoft.Jet.OLEDB.4.0; Data Source =+ Server.MapPath (+ pathss +)+;扩展属性= Excel 8.0); OleDbCommand ocmd = new OleDbCommand(select * from [+ sheetss +$],oconn) ; oconn.Open(); OleDbDataReader odr = ocmd.ExecuteReader(); while(odr.Read()) { SBPDCL_EnergyBillID = ScratchMaxid (NBPDCL_EnergyBill,did); CON_ACNO =有效(odr,0); CON_L OC =有效(odr,1); CON_NO =有效(odr,2); CAT_CODE =有效(odr,3); CAT =有效(odr,4); CAT_SUB =有效(odr,5); CAT_METER =有效(odr,6); FEDER_TYPE =有效(odr,7); LOAD_SAN =有效(odr,8); LOAD_CON =有效(odr,9); MD =有效(odr,10); MD_TAR =有效(odr,11); PR_TAR =有效(odr,12); NAME =有效(odr,13); F_H_NAME =有效(odr,14); ADDRESS =有效(odr,15); ADDRESS_1 =有效(odr,16); CON_STATUS =有效(odr,17); READ_DATE =有效(odr,18); LREAD_DATE =有效(odr,19); PAST_READ =有效(odr,20); PR_READ =有效(odr,21); UNIT_CON =有效(odr,22); MIN_UNIT =有效(odr,23); UNIT_CH =有效(odr,24); ADD_UNIT =有效(odr,25); TEMP_READ =有效(odr,26); MRP_READ =有效(odr,27); FREE_UNIT =有效(odr,28); FREE_ENG =有效(odr,29); AVG_READ =有效(odr,30) ; DATE_AVG =有效(odr,31); MC_MONTH =有效(odr,32); MC_UNIT =有效(odr,33 ); NO_BILLMON =有效(odr,34); NO_RENTMON =有效(odr,35); ENG_CHARGE =有效(odr, 36); ENG_AC_CH =有效(odr,37); FIX_CHARGE =有效(odr,38); MTR_RENTCH =有效(odr ,39); M_RENT_APP =有效(odr,40); DPS =有效(odr, 41); FPFCA =有效(odr,42); FPPCA =有效(odr,43); CAP_CHARGE =有效(odr ,44); MCB_CHARGE =有效(odr,45); MIS_CHARGE =有效(odr,46); ELEC_DUTY =有效( odr,47); PFS =有效(odr,48); OTHER_CH =有效(odr,49); TOT_ASST =有效(odr,50); GRAND_TOT =有效(odr,51); REBATE =有效(odr,52); REBATE_PF =有效(odr,53); NET_AMT =有效(odr,54); GRACE_AMT =有效(odr,55); LESS_CR =有效(odr,56); BL_BASIS =有效(odr,57); BILL_CYCLE =有效(odr,58); BILL_DATE =有效(odr,59); DUE_DATE =有效(odr,60); BILL_MONTH =有效(odr, 61); GRACE_DATE =有效(odr,62); F_DATE =有效(odr,63); T_DATE =有效(odr ,64); ARR_DUTY =有效(odr,65); ARR_ENG =有效(odr,66); ARR_DPS =有效( odr,67); ARR_PFS =有效(odr,68); ARR_DPSPFS =有效(odr,69); ARR_ABENG =有效(odr,70); ARR_ABDPS =有效(odr,71); CF_DUTY =有效(odr,72); CF_ENG =有效(odr,73); CF_DPS =有效(odr,74); CF_PFS =有效(odr,75); CF_DPSPFS =有效(odr,76); CF_ABENG =有效(odr,77); CF_ABDPS =有效(odr,78); RNS_ARR_M =有效(odr,79); RNS_ARR_U =有效(odr,80); RNS_ARR_AM =有效(odr,81 ); RNS_ARR_MS =有效(odr,82); RNS_ARR_US =有效(odr,83); RNS_ARR_AS =有效(odr, 84); RNS_CF_M =有效(odr,85); RNS_CF_U =有效(odr,86); RNS_CF_AMT =有效(odr ,87); RNS_CF_MS =有效(odr,88); RNS_CF_US =有效(odr,89); RNS_CF_AS =有效( odr,90); RNS_MRP_M =有效(odr,91); RNS_MRP_U =有效(odr,92); COLL_MODE =有效(odr,93); RECPT_CODE =有效(odr,94); RECEPT_NO =有效(odr,95); COLL_DATE =有效(odr,96); COLL_AMT =有效(odr,97); NON_PRECP =有效(odr,98); NON_PRECNO =有效(odr,99); NON_PAMT =有效(odr,100); NO N_PDATE =有效(odr,101); RCDC_AMT =有效(odr,102); TYPE_RCDC =有效(odr,103); RCDC_DATE =有效(odr,104); R_REC_CODE =有效(odr,105); R_REC_NO =有效(odr,106); REBATE_ALL =有效(odr,107); NO_REC =有效(odr,108); NO_RECON =有效(odr,109); COLL_AMTON =有效(odr,110); TYPE_BILL =有效(odr,111); COLL_BODY =有效(odr,112); TR_ABEENG =有效(odr,113); TR_ABEDPS =有效(odr,114); ADJ_ENG =有效(odr,115); ADJ_DUTY =有效(odr,116); ADJ_DPS =有效(odr,117); ADJ_UNIT =有效(odr,118); BADJ_ENG =有效(odr,119); BADJ_DPS =有效(odr,12 0); BADJ_DUTY =有效(odr,121); CADJ_ENG =有效(odr,122); CADJ_DUTY =有效(odr ,123); CADJ_DPS =有效(odr,124); TROD_ENG =有效(odr,125); TROD_DUTY =有效( odr,126); TROD_DPS =有效(odr,127); TROD_ABENG =有效(odr,128); TROD_ABDPS =有效(odr,129); REM_CORR =有效(odr,130); REM_METER =有效(odr,131); REM_FPPCA =有效(odr,132); LEG_STATUS =有效(odr,133); LEG_DATE =有效(odr,134); PAY_MODE =有效(odr,135); L_PAY =有效(odr,136); L_PAYDT =有效(odr,137); L_RECNO =有效(odr,138); P_CENGCH =有效(odr,139); P_CDUTY =有效(odr,140); P_CDPS =有效(odr,141); P_AENGCH =有效(odr,142); P_ADUTY =有效(odr,143); P_ADPS =有效(odr,144); P_NENG =有效(odr,145); P_NDUTY =有效(odr,146); P_NDPS =有效(odr,147); DOC =有效(odr,148); DIV =有效(odr,149); SUB_DIV =有效(odr,150); SECTION =有效(odr,151); METER_NO =有效(odr,152); METER_CAP =有效(odr,153); CAP_CH =有效(odr,154); MR_MF =有效(odr,155); STATUS_DT =有效(odr,156); SD_INST =有效(odr,157); ERR =有效(odr,158); PHASE =有效(odr,159); MRP_DATE = va盖子(odr,160); MTR_STAT =有效(odr,161); READ_STAT =有效(odr,162); CON_STAT =有效(odr,163); LINE_STAT =有效(odr,164); TR_NO =有效(odr,165); POLE_NO =有效(odr,166); ROUT_NO =有效(odr,167); LDB_MON =有效(odr,168); TBB_MON =有效(odr,169); LDR_MON =有效(odr,170); TBR_MON =有效(odr,171); MRPB_MON =有效(odr,172); SRCB_MON =有效(odr,173); CATC_MON =有效(odr,174); LOADC_MON =有效(odr,175); NAMEC_MON =有效(odr,176); NARR_MON =有效(odr,177); AREA_CODE =有效(odr,178); ID_AREA =有效(odr,179); ID_NO =有效(odr,180); FLAG_NSRC =有效(odr,181); FLAG_RCDC =有效(odr,182); FLAG_DC =有效(odr,183); FLAG_MRP =有效(odr,184); FLAG_BNP =有效(odr,185); FLAG_LNP =有效(odr,186); FLAG_BP =有效(odr,187); FLAG_LP =有效(odr,188); FEE_NAME =有效(odr,189); FEE_TYPE =有效(odr,190); FEE_CODE =有效(odr,191); INT_SD =有效(odr,192); TDS_SD =有效(odr,193); BOOK_NO =有效(odr,194); DUE_AREA =有效(odr,195); PSS =有效(odr,196); L1_UNIT =有效(odr,197); L2_UNIT =有效(odr,198); L3_UNIT =有效(odr,199); L4_UNIT =有效(odr,200); L1_MONTH =有效(odr,201); L2_MONTH =有效(odr,202); L3_MONTH =有效(odr,203); L4_MONTH =有效(odr,204); if(READ_DATE ==0 ) { READ_DATE =; } if(LREAD_DATE ==0) { LREAD_DATE =; } if(DATE_AVG ==0) { DATE_AVG =; } if(BILL_DATE ==0) { BILL_DATE =; } if(DUE_DATE ==0) { DUE_DATE =; } if(BILL_MONTH ==0) { BILL_MONTH =; } if(GRACE_DATE ==0) { GRACE_DATE =; } if(F_DATE ==0) { F_DATE =; } if(T_DATE ==0) { T_DATE =; } if(COLL_DATE ==0) { COLL_DATE =; } if(NON_PDATE ==0) { NON_PDATE =; } if(RCDC_DATE ==0) { RCDC_DATE = ; } if(LEG_DATE ==0) { LEG_DATE = ; } if(L_PAYDT ==0) { L_PAYDT = ; } if(DOC ==0) { DOC =; } if(STATUS_DT ==0) { STATUS_DT =; } if(MRP_DATE ==0) { MRP_DATE =; } query =; 查询+ =插入NBPDCL_EnergyBill; 查询+ =(; 查询+ =确实,CON_ACNO,CON_LOC,CON_NO,CAT_CODE,CAT,CAT_SUB,CAT_METER,FEDER_TYPE,LOAD_SAN,LOAD_CON,MD,MD_TAR ,; 查询+ =PR_TAR,NAME,F_H_NA ME,ADDRESS,ADDRESS_1,CON_STATUS,READ_DATE,LREAD_DATE,PAST_READ,PR_READ,; 查询+ =UNIT_CON,MIN_UNIT,UNIT_CH,ADD_UNIT,TEMP_READ,MRP_READ,FREE_UNIT,FREE_ENG,AVG_READ,DATE_AVG, ; 查询+ =MC_MONTH,MC_UNIT,NO_BILLMON,NO_RENTMON,ENG_CHARGE,ENG_AC_CH,FIX_CHARGE,MTR_RENTCH,M_RENT_APP,; 查询+ =DPS,FPFCA, FPPCA,CAP_CHARGE,MCB_CHARGE,MIS_CHARGE,ELEC_DUTY,PFS,OTHER_CH,TOT_ASST,GRAND_TOT,; 查询+ =REBATE,REBATE_PF,NET_AMT,GRACE_AMT,LESS_CR,BL_BASIS,BILL_CYCLE,BILL_DATE,DUE_DATE, BILL_MONTH,; 查询+ =GRACE_DATE,F_DATE,T_DATE,ARR_DUTY,ARR_ENG,ARR_DPS,ARR_PFS,ARR_DPSPFS,ARR_ABENG,ARR_ABDPS,; 查询+ = CF_DUTY,CF_ENG,CF_DPS,CF_PFS,CF_DPSPFS,CF_ABENG,CF_ABDPS,RNS_ARR_M,RNS_ARR_U,RNS_ARR_AM,; 查询+ =RNS_ARR_MS,RNS_ARR_US,RNS_ARR_AS,RNS_CF_M,RNS_CF_U,RNS_CF_AMT,RNS_CF_MS,RNS_CF_US, RNS_CF_AS,; 查询+ =RNS_MRP_M,RNS_MRP_U,COLL_MODE,RECPT_CODE,RECEPT_NO,COLL_DATE,COLL_AMT,NON_PRECP,NON_PRECNO,; 查询+ =NON_PAMT,NON_PDATE,RCDC_AMT,TYPE_RCDC,RCDC_DATE,R_REC_CODE,R_REC_NO,REBATE_ALL, NO_REC,NO_RECON,; 查询+ =COLL_AMTON,TYPE_BILL,COLL_BODY,TR_ABEENG,TR_ABEDPS,ADJ_ENG,ADJ_DUTY,ADJ_DPS,ADJ_UNIT,BADJ_ENG,; 查询+ =BADJ_DPS,BADJ_DUTY,CADJ_ENG,CADJ_DUTY,CADJ_DPS,TROD_ENG,TROD_DUTY,TROD_DPS,TROD_ABENG,TROD_ABDPS,; 查询+ =REM_CORR,REM_METER,REM_FPPCA,LEG_STATUS,LEG_DATE,PAY_MODE,L_PAY, L_PAYDT,L_RECNO,P_CENGCH,P_CDUTY,; 查询+ =P_CDPS,P_AENGCH,P_ADUTY,P_ADPS,P_NENG,P_NDUTY,P_NDPS,DOC,DIV,SUB_DIV,SECTION,METER_NO,METER_CAP,; 查询+ =CAP_CH,MR_MF,STATUS_DT,SD_INST,ERR,PHASE,MRP_DATE,MTR_STAT,READ_STAT,CON_STAT,LINE_STAT,TR_NO,; 查询+ = POLE_NO,ROUT_NO,LDB_MON,TBB_MON,LDR_MON,TBR_MON,MRPB_MON,SRCB_MON,CATC_MO N,LOADC_MON,NAMEC_MON,NARR_MON,AREA_CODE,; 查询+ =ID_AREA,ID_NO,FLAG_NSRC,FLAG_RCDC,FLAG_DC,FLAG_MRP,FLAG_BNP,FLAG_LNP,FLAG_BP,FLAG_LP,; 查询+ =FEE_NAME,FEE_TYPE,FEE_CODE,INT_SD,TDS_SD,BOOK_NO,DUE_AREA,PSS,L1_UNIT,L2_UNIT,L3_UNIT,L4_UNIT,L1_MONTH,L2_MONTH,L3_MONTH,L4_MONTH; 查询+ =); 查询+ =值; 查询+ =(; 查询+ =+ SBPDCL_EnergyBillID + ,'+ CON_ACNO +','+ CON_LOC +','+ CON_NO +',+ CAT_CODE +,'+ CAT +','+ CAT_SUB +',' + CAT_METER +','+ FEDER_TYPE +',+ LOAD_SAN +,+ LOAD_CON +,+ MD +,+ MD_TAR +',; query + ='+ PR_TAR +','+ NAME +','+ F_H_NAME +','+ ADDRESS +','+ ADDRESS_1 +','+ CON_STATUS + ','+ READ_DATE +','+ LREAD_DATE +',+ PAST_READ +,+ PR_READ +,; 查询+ =+ UNIT_CON +, + MIN_UNIT +,+ UNIT_CH +,+ ADD_UNIT +,+ TEMP_READ +,+ MRP_READ +,+ FREE_UNIT +,+ FREE_ENG +,+ AVG_READ +, + DATE_AVG +',; 查询+ =+ MC_MONTH +,+ MC_UNIT +,+ NO_BILLMON +,+ NO_RENTMON +,+ ENG_CHARGE +, + ENG_AC_CH +,+ FIX_CHARGE +,+ MTR_RENTCH +,+ M_RENT_APP +',; 查询+ =+ DPS +,+ FPFCA + ,+ FPPCA +,+ CAP_CHARGE +,+ MCB_CHARGE +,+ MIS_CHARGE +,+ ELEC_DUTY +,+ PFS +,+ OTHER_CH +,+ TOT_ASST +, + GRAND_TOT +,; 查询+ =+ REBATE +,+ REBATE_PF +,+ NET_AMT +,+ GRACE_AMT +,+ LESS_CR +, '+ BL_BASIS +',+ BILL_CYCLE +,'+ BILL_DATE +','+ DUE_DATE +','+ BILL_MONTH +',; 查询+ =' + GRACE_DATE +','+ F_DATE +','+ T_DATE +',+ ARR_DUTY +,+ ARR_ENG +,+ ARR_DPS +,+ ARR_PFS +,+ ARR_DPSPFS + ,+ ARR_ABENG +,+ ARR_ABDPS +,; 查询+ =+ CF_DUTY +,+ CF_ENG +,+ CF_DPS +,+ CF_PFS + ,+ CF_DPSPFS +,+ CF_ABENG +,+ CF_ABDPS +,+ RNS_ARR_M +,+ RNS_ARR_U +,+ RNS_ARR_AM +,; 查询+ =+ RNS_ARR_MS +,+ RNS_ARR_US +,+ RNS_ARR_AS +,+ RNS_CF_M +,+ RNS_CF_U +,+ RNS_CF_AMT +,+ RNS_CF_MS +,+ RNS_CF_US +, + RNS_CF_AS +,; 查询+ =+ RNS_MRP_M +,+ RNS_MRP_U +,+ + COLL_MODE +','+ RECPT_CODE +',+ RECEPT_NO +,'+ COLL_DATE +',+ COLL_AMT +,+ NON_PRECP +',+ NON_PRECNO +,; 查询+ =+ NON_PAMT + ,'+ NON_PDATE +',+ RCDC_AMT +,+ TYPE_RCDC +,+ RCDC_DATE +','+ R_REC_CODE +',+ R_REC_NO +,+ REBA TE_ALL +,+ NO_REC +,+ NO_RECON +,; 查询+ =+ COLL_AMTON +,+ TYPE_BILL +','+ COLL_BODY + ',+ TR_ABEENG +,+ TR_ABEDPS +,+ ADJ_ENG +,+ ADJ_DUTY +,+ ADJ_DPS +,+ ADJ_UNIT +,+ BADJ_ENG +,; 查询+ =+ BADJ_DPS +,+ BADJ_DUTY +,+ CADJ_ENG +,+ CADJ_DUTY +,+ CADJ_DPS +,+ TROD_ENG +,+ TROD_DUTY +, + TROD_DPS +,+ TROD_ABENG +,+ TROD_ABDPS +,; 查询+ ='+ REM_CORR +','+ REM_METER +',' + REM_FPPCA +',+ LEG_STATUS +,'+ LEG_DATE +',+ PAY_MODE +,+ L_PAY +,+ L_PAYDT +','+ L_RECNO +',+ P_CENGCH +,+ P_CDUTY +,; 查询+ =+ P_CDPS +,+ P_AENGCH +,+ P_ADUTY +,+ P_ADPS +,+ P_NENG +,+ P_NDUTY +,+ P_NDPS +,+ DOC +','+ DIV +','+ SUB_DIV +','+ SECTION +',' + METER_NO +','+ METER_ CAP +',; 查询+ ='+ CAP_CH +',+ MR_MF +,'+ STATUS_DT +',+ SD_INST +,'+ ERR +',+ PHASE +,+ MRP_DATE +',+ MTR_STAT +,+ READ_STAT +,+ CON_STAT +,+ LINE_STAT +,+ + TR_NO +' ,; 查询+ ='+ POLE_NO +','+ ROUT_NO +','+ LDB_MON +','+ TBB_MON +','+ LDR_MON +','+ TBR_MON +','+ MRPB_MON +','+ SRCB_MON +','+ CATC_MON +','+ LOADC_MON +','+ NAMEC_MON + ','+ NARR_MON +','+ AREA_CODE +',; 查询+ ='+ ID_AREA +',+ ID_NO +,'+ FLAG_NSRC +','+ FLAG_RCDC +','+ FLAG_DC +','+ FLAG_MRP +','+ FLAG_BNP +','+ FLAG_LNP +','+ FLAG_BP + ','+ FLAG_LP +',; 查询+ ='+ FEE_NAME +','+ FEE_TYPE +','+ FEE_CODE +', + INT_SD +,+ TDS_SD +,'+ BOOK_NO +','+ DUE_AREA +','+ PSS +',+ L1_UNIT +,+ L2_UNIT +,+ L3_UNIT +,+ L4_UNIT +,+ L1_MONTH + ','+ L2_MONTH +','+ L3_MONTH +','+ L4_MONTH +'; query + =) ; forTran(查询); } oconn.Close(); if(chkProc == 1) { tran.Commit(); lblExcept.Text =处理完成; txtTitle.Text =; txtSheetName.Text =; txtRemarks.Text =; txtTitle.Focus(); if(Convert.ToInt32(con.State)> = 1) { con.Close(); } } 其他 { tram = 0; 抛出新的异常(错误); } } This code is working but in many column values is zero while in excel file value is not zero...so how i can insert corect value in sql from excel plz help me..Thanks...public void FindExcelData(string pathss, string sheetss) { chkProc = 0; OleDbConnection oconn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("" + pathss + "") + ";Extended Properties=Excel 8.0"); OleDbCommand ocmd = new OleDbCommand("select * from [" + sheetss + "$]", oconn); oconn.Open(); OleDbDataReader odr = ocmd.ExecuteReader(); while (odr.Read()) { SBPDCL_EnergyBillID = ScratchMaxid("NBPDCL_EnergyBill", "did"); CON_ACNO = valid(odr, 0); CON_LOC = valid(odr, 1); CON_NO = valid(odr, 2); CAT_CODE = valid(odr, 3); CAT = valid(odr, 4); CAT_SUB = valid(odr, 5); CAT_METER = valid(odr, 6); FEDER_TYPE = valid(odr, 7); LOAD_SAN = valid(odr, 8); LOAD_CON = valid(odr, 9); MD = valid(odr, 10); MD_TAR = valid(odr, 11); PR_TAR = valid(odr, 12); NAME = valid(odr, 13); F_H_NAME = valid(odr, 14); ADDRESS = valid(odr, 15); ADDRESS_1 = valid(odr, 16); CON_STATUS = valid(odr, 17); READ_DATE = valid(odr, 18); LREAD_DATE = valid(odr, 19); PAST_READ = valid(odr, 20); PR_READ = valid(odr, 21); UNIT_CON = valid(odr, 22); MIN_UNIT = valid(odr, 23); UNIT_CH = valid(odr, 24); ADD_UNIT = valid(odr, 25); TEMP_READ = valid(odr, 26); MRP_READ = valid(odr, 27); FREE_UNIT = valid(odr, 28); FREE_ENG = valid(odr, 29); AVG_READ = valid(odr, 30); DATE_AVG = valid(odr, 31); MC_MONTH = valid(odr, 32); MC_UNIT = valid(odr, 33); NO_BILLMON = valid(odr, 34); NO_RENTMON = valid(odr, 35); ENG_CHARGE = valid(odr, 36); ENG_AC_CH = valid(odr, 37); FIX_CHARGE = valid(odr, 38); MTR_RENTCH = valid(odr, 39); M_RENT_APP = valid(odr, 40); DPS = valid(odr, 41); FPFCA = valid(odr, 42); FPPCA = valid(odr, 43); CAP_CHARGE = valid(odr, 44); MCB_CHARGE = valid(odr, 45); MIS_CHARGE = valid(odr, 46); ELEC_DUTY = valid(odr, 47); PFS = valid(odr, 48); OTHER_CH = valid(odr, 49); TOT_ASST = valid(odr, 50); GRAND_TOT = valid(odr, 51); REBATE = valid(odr, 52); REBATE_PF = valid(odr, 53); NET_AMT = valid(odr, 54); GRACE_AMT = valid(odr, 55); LESS_CR = valid(odr, 56); BL_BASIS = valid(odr, 57); BILL_CYCLE = valid(odr, 58); BILL_DATE = valid(odr, 59); DUE_DATE = valid(odr, 60); BILL_MONTH = valid(odr, 61); GRACE_DATE = valid(odr, 62); F_DATE = valid(odr, 63); T_DATE = valid(odr, 64); ARR_DUTY = valid(odr, 65); ARR_ENG = valid(odr, 66); ARR_DPS = valid(odr, 67); ARR_PFS = valid(odr, 68); ARR_DPSPFS = valid(odr, 69); ARR_ABENG = valid(odr, 70); ARR_ABDPS = valid(odr, 71); CF_DUTY = valid(odr, 72); CF_ENG = valid(odr, 73); CF_DPS = valid(odr, 74); CF_PFS = valid(odr, 75); CF_DPSPFS = valid(odr, 76); CF_ABENG = valid(odr, 77); CF_ABDPS = valid(odr, 78); RNS_ARR_M = valid(odr, 79); RNS_ARR_U = valid(odr, 80); RNS_ARR_AM = valid(odr, 81); RNS_ARR_MS = valid(odr, 82); RNS_ARR_US = valid(odr, 83); RNS_ARR_AS = valid(odr, 84); RNS_CF_M = valid(odr, 85); RNS_CF_U = valid(odr, 86); RNS_CF_AMT = valid(odr, 87); RNS_CF_MS = valid(odr, 88); RNS_CF_US = valid(odr, 89); RNS_CF_AS = valid(odr, 90); RNS_MRP_M = valid(odr, 91); RNS_MRP_U = valid(odr, 92); COLL_MODE = valid(odr, 93); RECPT_CODE = valid(odr, 94); RECEPT_NO = valid(odr, 95); COLL_DATE = valid(odr, 96); COLL_AMT = valid(odr, 97); NON_PRECP = valid(odr, 98); NON_PRECNO = valid(odr, 99); NON_PAMT = valid(odr, 100); NON_PDATE = valid(odr, 101); RCDC_AMT = valid(odr, 102); TYPE_RCDC = valid(odr, 103); RCDC_DATE = valid(odr, 104); R_REC_CODE = valid(odr, 105); R_REC_NO = valid(odr, 106); REBATE_ALL = valid(odr, 107); NO_REC = valid(odr, 108); NO_RECON = valid(odr, 109); COLL_AMTON = valid(odr, 110); TYPE_BILL = valid(odr, 111); COLL_BODY = valid(odr, 112); TR_ABEENG = valid(odr, 113); TR_ABEDPS = valid(odr, 114); ADJ_ENG = valid(odr, 115); ADJ_DUTY = valid(odr, 116); ADJ_DPS = valid(odr, 117); ADJ_UNIT = valid(odr, 118); BADJ_ENG = valid(odr, 119); BADJ_DPS = valid(odr, 120); BADJ_DUTY = valid(odr, 121); CADJ_ENG = valid(odr, 122); CADJ_DUTY = valid(odr, 123); CADJ_DPS = valid(odr, 124); TROD_ENG = valid(odr, 125); TROD_DUTY = valid(odr, 126); TROD_DPS = valid(odr, 127); TROD_ABENG = valid(odr, 128); TROD_ABDPS = valid(odr, 129); REM_CORR = valid(odr, 130); REM_METER = valid(odr, 131); REM_FPPCA = valid(odr, 132); LEG_STATUS = valid(odr, 133); LEG_DATE = valid(odr, 134); PAY_MODE = valid(odr, 135); L_PAY = valid(odr, 136); L_PAYDT = valid(odr, 137); L_RECNO = valid(odr, 138); P_CENGCH = valid(odr, 139); P_CDUTY = valid(odr, 140); P_CDPS = valid(odr, 141); P_AENGCH = valid(odr, 142); P_ADUTY = valid(odr, 143); P_ADPS = valid(odr, 144); P_NENG = valid(odr, 145); P_NDUTY = valid(odr, 146); P_NDPS = valid(odr, 147); DOC = valid(odr, 148); DIV = valid(odr, 149); SUB_DIV = valid(odr, 150); SECTION = valid(odr, 151); METER_NO = valid(odr, 152); METER_CAP = valid(odr, 153); CAP_CH = valid(odr, 154); MR_MF = valid(odr, 155); STATUS_DT = valid(odr, 156); SD_INST = valid(odr, 157); ERR = valid(odr, 158); PHASE = valid(odr, 159); MRP_DATE = valid(odr, 160); MTR_STAT = valid(odr, 161); READ_STAT = valid(odr, 162); CON_STAT = valid(odr, 163); LINE_STAT = valid(odr, 164); TR_NO = valid(odr, 165); POLE_NO = valid(odr, 166); ROUT_NO = valid(odr, 167); LDB_MON = valid(odr, 168); TBB_MON = valid(odr, 169); LDR_MON = valid(odr, 170); TBR_MON = valid(odr, 171); MRPB_MON = valid(odr, 172); SRCB_MON = valid(odr, 173); CATC_MON = valid(odr, 174); LOADC_MON = valid(odr, 175); NAMEC_MON = valid(odr, 176); NARR_MON = valid(odr, 177); AREA_CODE = valid(odr, 178); ID_AREA = valid(odr, 179); ID_NO = valid(odr, 180); FLAG_NSRC = valid(odr, 181); FLAG_RCDC = valid(odr, 182); FLAG_DC = valid(odr, 183); FLAG_MRP = valid(odr, 184); FLAG_BNP = valid(odr, 185); FLAG_LNP = valid(odr, 186); FLAG_BP = valid(odr, 187); FLAG_LP = valid(odr, 188); FEE_NAME = valid(odr, 189); FEE_TYPE = valid(odr, 190); FEE_CODE = valid(odr, 191); INT_SD = valid(odr, 192); TDS_SD = valid(odr, 193); BOOK_NO = valid(odr, 194); DUE_AREA = valid(odr, 195); PSS = valid(odr, 196); L1_UNIT = valid(odr, 197); L2_UNIT = valid(odr, 198); L3_UNIT = valid(odr, 199); L4_UNIT = valid(odr, 200); L1_MONTH = valid(odr, 201); L2_MONTH = valid(odr, 202); L3_MONTH = valid(odr, 203); L4_MONTH = valid(odr, 204); if (READ_DATE == "0") { READ_DATE = ""; } if (LREAD_DATE == "0") { LREAD_DATE = ""; } if (DATE_AVG == "0") { DATE_AVG = ""; } if (BILL_DATE == "0") { BILL_DATE = ""; } if (DUE_DATE == "0") { DUE_DATE = ""; } if (BILL_MONTH == "0") { BILL_MONTH = ""; } if (GRACE_DATE == "0") { GRACE_DATE = ""; } if (F_DATE == "0") { F_DATE = ""; } if (T_DATE == "0") { T_DATE = ""; } if (COLL_DATE == "0") { COLL_DATE = ""; } if (NON_PDATE == "0") { NON_PDATE = ""; } if (RCDC_DATE == "0") { RCDC_DATE = ""; } if (LEG_DATE == "0") { LEG_DATE = ""; } if (L_PAYDT == "0") { L_PAYDT = ""; } if (DOC == "0") { DOC = ""; } if (STATUS_DT == "0") { STATUS_DT = ""; } if (MRP_DATE == "0") { MRP_DATE = ""; } query = ""; query += " insert into NBPDCL_EnergyBill "; query += " ( "; query += " did,CON_ACNO,CON_LOC,CON_NO,CAT_CODE,CAT,CAT_SUB,CAT_METER,FEDER_TYPE,LOAD_SAN,LOAD_CON,MD,MD_TAR,"; query += " PR_TAR,NAME,F_H_NAME,ADDRESS,ADDRESS_1,CON_STATUS,READ_DATE,LREAD_DATE,PAST_READ,PR_READ,"; query += " UNIT_CON,MIN_UNIT,UNIT_CH,ADD_UNIT,TEMP_READ,MRP_READ,FREE_UNIT,FREE_ENG,AVG_READ,DATE_AVG,"; query += " MC_MONTH,MC_UNIT,NO_BILLMON,NO_RENTMON,ENG_CHARGE,ENG_AC_CH,FIX_CHARGE,MTR_RENTCH,M_RENT_APP,"; query += " DPS,FPFCA,FPPCA,CAP_CHARGE,MCB_CHARGE,MIS_CHARGE,ELEC_DUTY,PFS,OTHER_CH,TOT_ASST,GRAND_TOT,"; query += " REBATE,REBATE_PF,NET_AMT,GRACE_AMT,LESS_CR,BL_BASIS,BILL_CYCLE,BILL_DATE,DUE_DATE,BILL_MONTH,"; query += " GRACE_DATE,F_DATE,T_DATE,ARR_DUTY,ARR_ENG,ARR_DPS,ARR_PFS,ARR_DPSPFS,ARR_ABENG,ARR_ABDPS,"; query += " CF_DUTY,CF_ENG,CF_DPS,CF_PFS,CF_DPSPFS,CF_ABENG,CF_ABDPS,RNS_ARR_M,RNS_ARR_U,RNS_ARR_AM,"; query += " RNS_ARR_MS,RNS_ARR_US,RNS_ARR_AS,RNS_CF_M,RNS_CF_U,RNS_CF_AMT,RNS_CF_MS,RNS_CF_US,RNS_CF_AS,"; query += " RNS_MRP_M,RNS_MRP_U,COLL_MODE,RECPT_CODE,RECEPT_NO,COLL_DATE,COLL_AMT,NON_PRECP,NON_PRECNO,"; query += " NON_PAMT,NON_PDATE,RCDC_AMT,TYPE_RCDC,RCDC_DATE,R_REC_CODE,R_REC_NO,REBATE_ALL,NO_REC,NO_RECON,"; query += " COLL_AMTON,TYPE_BILL,COLL_BODY,TR_ABEENG,TR_ABEDPS,ADJ_ENG,ADJ_DUTY,ADJ_DPS,ADJ_UNIT,BADJ_ENG,"; query += " BADJ_DPS,BADJ_DUTY,CADJ_ENG,CADJ_DUTY,CADJ_DPS,TROD_ENG,TROD_DUTY,TROD_DPS,TROD_ABENG,TROD_ABDPS,"; query += " REM_CORR,REM_METER,REM_FPPCA,LEG_STATUS,LEG_DATE,PAY_MODE,L_PAY,L_PAYDT,L_RECNO,P_CENGCH,P_CDUTY,"; query += " P_CDPS,P_AENGCH,P_ADUTY,P_ADPS,P_NENG,P_NDUTY,P_NDPS,DOC,DIV,SUB_DIV,SECTION,METER_NO,METER_CAP,"; query += " CAP_CH,MR_MF,STATUS_DT,SD_INST,ERR,PHASE,MRP_DATE,MTR_STAT,READ_STAT,CON_STAT,LINE_STAT,TR_NO,"; query += " POLE_NO,ROUT_NO,LDB_MON,TBB_MON,LDR_MON,TBR_MON,MRPB_MON,SRCB_MON,CATC_MON,LOADC_MON,NAMEC_MON,NARR_MON,AREA_CODE,"; query += " ID_AREA,ID_NO,FLAG_NSRC,FLAG_RCDC,FLAG_DC,FLAG_MRP,FLAG_BNP,FLAG_LNP,FLAG_BP,FLAG_LP,"; query += " FEE_NAME,FEE_TYPE,FEE_CODE,INT_SD,TDS_SD,BOOK_NO,DUE_AREA,PSS, L1_UNIT, L2_UNIT, L3_UNIT, L4_UNIT,L1_MONTH, L2_MONTH, L3_MONTH, L4_MONTH"; query += " ) "; query += " values "; query += " ( "; query += " " + SBPDCL_EnergyBillID + ",'" + CON_ACNO + "','" + CON_LOC + "','" + CON_NO + "'," + CAT_CODE + ",'" + CAT + "','" + CAT_SUB + "','" + CAT_METER + "','" + FEDER_TYPE + "'," + LOAD_SAN + "," + LOAD_CON + "," + MD + ",'" + MD_TAR + "',"; query += " '" + PR_TAR + "','" + NAME + "','" + F_H_NAME + "','" + ADDRESS + "','" + ADDRESS_1 + "','" + CON_STATUS + "','" + READ_DATE + "','" + LREAD_DATE + "'," + PAST_READ + "," + PR_READ + ","; query += " " + UNIT_CON + "," + MIN_UNIT + "," + UNIT_CH + "," + ADD_UNIT + "," + TEMP_READ + "," + MRP_READ + "," + FREE_UNIT + "," + FREE_ENG + "," + AVG_READ + ",'" + DATE_AVG + "',"; query += " " + MC_MONTH + "," + MC_UNIT + "," + NO_BILLMON + "," + NO_RENTMON + "," + ENG_CHARGE + "," + ENG_AC_CH + "," + FIX_CHARGE + "," + MTR_RENTCH + ",'" + M_RENT_APP + "',"; query += " " + DPS + "," + FPFCA + "," + FPPCA + "," + CAP_CHARGE + "," + MCB_CHARGE + "," + MIS_CHARGE + "," + ELEC_DUTY + "," + PFS + "," + OTHER_CH + "," + TOT_ASST + "," + GRAND_TOT + ","; query += " " + REBATE + "," + REBATE_PF + "," + NET_AMT + "," + GRACE_AMT + "," + LESS_CR + ",'" + BL_BASIS + "'," + BILL_CYCLE + ",'" + BILL_DATE + "','" + DUE_DATE + "','" + BILL_MONTH + "',"; query += " '" + GRACE_DATE + "','" + F_DATE + "','" + T_DATE + "'," + ARR_DUTY + "," + ARR_ENG + "," + ARR_DPS + "," + ARR_PFS + "," + ARR_DPSPFS + "," + ARR_ABENG + "," + ARR_ABDPS + ","; query += " " + CF_DUTY + "," + CF_ENG + "," + CF_DPS + "," + CF_PFS + "," + CF_DPSPFS + "," + CF_ABENG + "," + CF_ABDPS + "," + RNS_ARR_M + "," + RNS_ARR_U + "," + RNS_ARR_AM + ","; query += " " + RNS_ARR_MS + "," + RNS_ARR_US + "," + RNS_ARR_AS + "," + RNS_CF_M + "," + RNS_CF_U + "," + RNS_CF_AMT + "," + RNS_CF_MS + "," + RNS_CF_US + "," + RNS_CF_AS + ","; query += " " + RNS_MRP_M + "," + RNS_MRP_U + ",'" + COLL_MODE + "','" + RECPT_CODE + "'," + RECEPT_NO + ",'" + COLL_DATE + "'," + COLL_AMT + ",'" + NON_PRECP + "'," + NON_PRECNO + ","; query += " " + NON_PAMT + ",'" + NON_PDATE + "'," + RCDC_AMT + "," + TYPE_RCDC + ",'" + RCDC_DATE + "','" + R_REC_CODE + "'," + R_REC_NO + "," + REBATE_ALL + "," + NO_REC + "," + NO_RECON + ","; query += " " + COLL_AMTON + ",'" + TYPE_BILL + "','" + COLL_BODY + "'," + TR_ABEENG + "," + TR_ABEDPS + "," + ADJ_ENG + "," + ADJ_DUTY + "," + ADJ_DPS + "," + ADJ_UNIT + "," + BADJ_ENG + ","; query += " " + BADJ_DPS + "," + BADJ_DUTY + "," + CADJ_ENG + "," + CADJ_DUTY + "," + CADJ_DPS + "," + TROD_ENG + "," + TROD_DUTY + "," + TROD_DPS + "," + TROD_ABENG + "," + TROD_ABDPS + ","; query += " '" + REM_CORR + "','" + REM_METER + "','" + REM_FPPCA + "'," + LEG_STATUS + ",'" + LEG_DATE + "'," + PAY_MODE + "," + L_PAY + ",'" + L_PAYDT + "','" + L_RECNO + "'," + P_CENGCH + "," + P_CDUTY + ","; query += " " + P_CDPS + "," + P_AENGCH + "," + P_ADUTY + "," + P_ADPS + "," + P_NENG + "," + P_NDUTY + "," + P_NDPS + ",'" + DOC + "','" + DIV + "','" + SUB_DIV + "','" + SECTION + "','" + METER_NO + "','" + METER_CAP + "',"; query += " '" + CAP_CH + "'," + MR_MF + ",'" + STATUS_DT + "'," + SD_INST + ",'" + ERR + "'," + PHASE + ",'" + MRP_DATE + "'," + MTR_STAT + "," + READ_STAT + "," + CON_STAT + "," + LINE_STAT + ",'" + TR_NO + "',"; query += " '" + POLE_NO + "','" + ROUT_NO + "','" + LDB_MON + "','" + TBB_MON + "','" + LDR_MON + "','" + TBR_MON + "','" + MRPB_MON + "','" + SRCB_MON + "','" + CATC_MON + "','" + LOADC_MON + "','" + NAMEC_MON + "','" + NARR_MON + "','" + AREA_CODE + "',"; query += " '" + ID_AREA + "'," + ID_NO + ",'" + FLAG_NSRC + "','" + FLAG_RCDC + "','" + FLAG_DC + "','" + FLAG_MRP + "','" + FLAG_BNP + "','" + FLAG_LNP + "','" + FLAG_BP + "','" + FLAG_LP + "',"; query += " '" + FEE_NAME + "','" + FEE_TYPE + "','" + FEE_CODE + "'," + INT_SD + "," + TDS_SD + ",'" + BOOK_NO + "','" + DUE_AREA + "','" + PSS + "'," + L1_UNIT + "," + L2_UNIT + "," + L3_UNIT + "," + L4_UNIT + ",'" + L1_MONTH + "','" + L2_MONTH + "','" + L3_MONTH + "','" + L4_MONTH + "'"; query += " ) "; forTran(query); } oconn.Close(); if (chkProc == 1) { tran.Commit(); lblExcept.Text = "Process Completed"; txtTitle.Text = ""; txtSheetName.Text = ""; txtRemarks.Text = ""; txtTitle.Focus(); if (Convert.ToInt32(con.State) >= 1) { con.Close(); } } else { tram = 0; throw new Exception("Error"); } }推荐答案 ,oconn); oconn.Open(); OleDbDataReader odr = ocmd.ExecuteReader(); while(odr.Read()) { SBPDCL_EnergyBillID = ScratchMaxid(NBPDCL_EnergyBill,did); CON_ACNO =有效(odr,0); CON_LOC =有效(odr,1); CON_NO =有效(odr,2); CAT_CODE =有效(odr,3); CAT =有效(odr,4); CAT_SUB =有效(odr,5); CAT_METER =有效(odr,6) ; FEDER_TYPE =有效(odr,7); LOAD_SAN =有效(odr,8); LOAD_CON =有效(odr,9 ); MD =有效(odr,10); MD_TAR =有效(odr,11); PR_TAR =有效(odr,12); NAME =有效(odr,13); F_H_NAME =有效(odr,14); ADDRESS =有效(odr,15); ADDRESS_1 =有效(odr,16); CON_STATUS =有效(odr,17); READ_DATE =有效(odr,18); LREAD_DATE =有效(odr,19); PAST_READ =有效(odr,20); PR_READ =有效(odr,21); UNIT_CON =有效(odr,22); MIN_UNIT =有效(odr,23); UNIT_CH =有效(odr,24); ADD_UNIT =有效(odr,25); TEMP_READ =有效(odr,26); MRP_READ =有效(odr,27); FREE_UNIT =有效(odr,28); FREE_ENG =有效(odr,29); AVG_READ =有效(o dr,30); DATE_AVG =有效(odr,31); MC_MONTH =有效(odr,32); MC_UNIT =有效(odr,33); NO_BILLMON =有效(odr,34); NO_RENTMON =有效(odr,35); ENG_CHARGE =有效(odr,36); ENG_AC_CH =有效(odr,37); FIX_CHARGE =有效(odr,38); MTR_RENTCH =有效(odr,39); M_RENT_APP =有效(odr,40); DPS =有效(odr,41); FPFCA =有效(odr,42); FPPCA =有效(odr,43); CAP_CHARGE =有效(odr,44); MCB_CHARGE =有效(odr,45); MIS_CHARGE =有效(odr,46); ELEC_DUTY =有效(odr,47); PFS =有效(odr,48); OTHER_CH =有效(odr,49); TOT_ASST = vali d(odr,50); GRAND_TOT =有效(odr,51); REBATE =有效(odr,52); REBATE_PF =有效(odr,53); NET_AMT =有效(odr,54); GRACE_AMT =有效(odr,55); LESS_CR =有效(odr,56); BL_BASIS =有效(odr,57); BILL_CYCLE =有效(odr,58); BILL_DATE =有效(odr,59); DUE_DATE =有效(odr,60); BILL_MONTH =有效(odr,61); GRACE_DATE =有效(odr,62); F_DATE =有效(odr,63); T_DATE =有效(odr,64); ARR_DUTY =有效(odr,65); ARR_ENG =有效(odr,66); ARR_DPS =有效(odr,67); ARR_PFS =有效(odr,68); ARR_DPSPFS =有效(odr,69); ARR_ABENG = va盖子(odr,70); ARR_ABDPS =有效(odr,71); CF_DUTY =有效(odr,72); CF_ENG =有效(odr,73); CF_DPS =有效(odr,74); CF_PFS =有效(odr,75); CF_DPSPFS =有效(odr,76); CF_ABENG =有效(odr,77); CF_ABDPS =有效(odr,78); RNS_ARR_M =有效(odr,79); RNS_ARR_U =有效(odr,80); RNS_ARR_AM =有效(odr,81); RNS_ARR_MS =有效(odr,82); RNS_ARR_US =有效(odr,83); RNS_ARR_AS =有效(odr,84); RNS_CF_M =有效(odr,85); RNS_CF_U =有效(odr,86); RNS_CF_AMT =有效(odr,87); RNS_CF_MS =有效(odr,88); RNS_CF_US =有效(odr,89); RNS_ CF_AS =有效(odr,90); RNS_MRP_M =有效(odr,91); RNS_MRP_U =有效(odr,92); COLL_MODE =有效(odr,93); RECPT_CODE =有效(odr,94); RECEPT_NO =有效(odr,95); COLL_DATE =有效(odr,96); COLL_AMT =有效(odr,97); NON_PRECP =有效(odr,98); NON_PRECNO =有效(odr,99); NON_PAMT =有效(odr,100); NON_PDATE =有效(odr,101); RCDC_AMT =有效(odr,102); TYPE_RCDC =有效(odr,103); RCDC_DATE =有效(odr,104); R_REC_CODE =有效(odr,105); R_REC_NO =有效(odr,106); REBATE_ALL =有效(odr,107); NO_REC =有效(odr,108); NO_RECON =有效(odr,109); COLL_AMTON =有效(odr,110); TYPE_BILL =有效(odr,111); COLL_BODY =有效(odr,112); TR_ABEENG =有效(odr,113); TR_ABEDPS =有效(odr,114); ADJ_ENG =有效(odr,115) ; ADJ_DUTY =有效(odr,116); ADJ_DPS =有效(odr,117); ADJ_UNIT =有效(odr,118 ); BADJ_ENG =有效(odr,119); BADJ_DPS =有效(odr,120); BADJ_DUTY =有效(odr, 121); CADJ_ENG =有效(odr,122); CADJ_DUTY =有效(odr,123); CADJ_DPS =有效(odr) ,124); TROD_ENG =有效(odr,125); TROD_DUTY =有效(odr,126); TROD_DPS =有效( odr,127); TROD_ABENG =有效(odr,128); TROD_ABDPS =有效(odr,129); REM_CORR =有效(odr,130); REM_METER =有效(odr,131); REM_FPPCA =有效(odr,132); LEG_STATUS =有效(odr,133); LEG_DATE =有效(odr,134); PAY_MODE =有效(odr,135); L_PAY =有效(odr,136); L_PAYDT =有效(odr,137); L_RECNO =有效(odr,138); P_CENGCH =有效(odr,139); P_CDUTY =有效(odr,140); P_CDPS =有效(odr,141); P_AENGCH =有效(odr,142); P_ADUTY =有效(odr,143); P_ADPS =有效(odr,144); P_NENG =有效(odr,145); P_NDUTY =有效(odr,146); P_NDPS =有效(odr,147); DOC =有效(odr,148); DIV =有效(odr,149); SUB_DIV =有效(odr,150); SECTION =有效(odr,151); METER_NO =有效(odr,152); METER_CAP =有效(odr,153); CAP_CH =有效(odr,154); MR_MF =有效(odr,155); STATUS_DT =有效(odr,156); SD_INST =有效(odr,157); ERR =有效(odr,158); PHASE =有效(odr,159); MRP_DATE =有效(odr,160); MTR_STAT =有效(odr,161); READ_STAT =有效(odr,162); CON_STAT =有效(odr,163); LINE_STAT =有效(odr,164); TR_NO =有效(odr,165); POLE_NO =有效(odr,166); ROUT_NO =有效(odr,167); LDB_MON =有效(odr,168); TBB_MON =有效(odr,169); LDR_MON =有效(odr,170); TBR_MON =有效(odr,171); MRPB_MON = valid(odr, 172); SRCB_MON = valid(odr, 173); CATC_MON = valid(odr, 174); $b $b LOADC_MON = valid(odr, 175); NAMEC_MON = valid(odr, 176); NARR_MON = valid(odr, 177); $ b$b AREA_CODE = valid(odr, 178); ID_AREA = valid(odr, 179); ID_NO = valid(odr, 180); FLAG_NSRC = valid(odr, 181); FLAG_RCDC = valid(odr, 182); FLAG_DC = valid(odr, 183); FLAG_MRP = valid(odr, 184); FLAG_BNP = valid(odr, 185); FLAG_LNP = valid(odr, 186); FLAG_BP = valid(odr, 187); FLAG_LP = valid(odr, 188); FEE_NAME = valid(odr, 189); FEE_TYPE = valid(odr, 190); FEE_CODE = valid(odr, 191); INT_SD = valid(odr, 192); TDS_SD = valid(odr, 193); BOOK_NO = valid(odr, 194); DUE_AREA = valid(odr, 195); PSS = valid(odr, 196); L1_UNIT = valid(odr, 197); L2_UNIT = valid(odr, 198); L3_UNIT = valid(odr, 199); L4_UNIT = valid(odr, 200); L1_MONTH = valid(odr, 201); L2_MONTH = valid(odr, 202); L3_MONTH = valid(odr, 203); L4_MONTH = valid(odr, 204); if (READ_DATE == \"0\") { READ_DATE = \"\"; } if (LREAD_DATE == \"0\") $b $b { LREAD_DATE = \"\"; } if (DATE_AVG == \"0\") { DATE_AVG = \"\"; } if (BILL_DATE == \"0\") { BILL_DATE = \"\"; } if (DUE_DATE == \"0\") { DUE_DATE = \"\"; } if (BILL_MONTH == \"0\") { BILL_MONTH = \"\"; } if (GRACE_DATE == \"0\") { GRACE_DATE = \"\"; } if (F_DATE == \"0\") { F_DATE = \"\"; } if (T_DATE == \"0\") { T_DATE = \"\"; } if (COLL_DATE == \"0\") { COLL_DATE = \"\"; } if (NON_PDATE == \"0\") { NON_PDATE = \"\"; } if (RCDC_DATE == \"0\") { RCDC_DATE = \"\"; } if (LEG_DATE == \"0\") { LEG_DATE = \"\"; } if (L_PAYDT == \"0\") { L_PAYDT = \"\"; } if (DOC == \"0\") { DOC = \"\"; } if (STATUS_DT == \"0\") { STATUS_DT = \"\"; } if (MRP_DATE == \"0\") { MRP_DATE = \"\"; } query = \"\"; query += \" insert into NBPDCL_EnergyBill \"; query += \" ( \"; query += \" did,CON_ACNO,CON_LOC,CON_NO,CAT_CODE,CAT,CAT_SUB,CAT_METER,FEDER_TYPE,LOAD_SAN,LOAD_CON,MD,MD_TAR,\"; query += \" PR_TAR,NAME,F_H_NAME,ADDRESS,ADDRESS_1,CON_STATUS,READ_DATE,LREAD_DATE,PAST_READ,PR_READ,\"; query += \" UNIT_CON,MIN_UNIT,UNIT_CH,ADD_UNIT,TEMP_READ,MRP_READ,FREE_UNIT,FREE_ENG,AVG_READ,DATE_AVG,\"; query += \" MC_MONTH,MC_UNIT,NO_BILLMON,NO_RENTMON,ENG_CHARGE,ENG_AC_CH,FIX_CHARGE,MTR_RENTCH,M_RENT_APP,\"; query += \" DPS,FPFCA,FPPCA,CAP_CHARGE,MCB_CHARGE,MIS_CHARGE,ELEC_DUTY,PFS,OTHER_CH,TO T_ASST,GRAND_TOT,\"; query += \" REBATE,REBATE_PF,NET_AMT,GRACE_AMT,LESS_CR,BL_BASIS,BILL_CYCLE,BILL_DATE,DUE_DATE,BILL_MONTH,\"; query += \" GRACE_DATE,F_DATE,T_DATE,ARR_DUTY,ARR_ENG,ARR_DPS,ARR_PFS,ARR_DPSPFS,ARR_ABENG,ARR_ABDPS,\"; query += \" CF_DUTY,CF_ENG,CF_DPS,CF_PFS,CF_DPSPFS,CF_ABENG,CF_ABDPS,RNS_ARR_M,RNS_ARR_U,RNS_ARR_AM,\"; query += \" RNS_ARR_MS,RNS_ARR_US,RNS_ARR_AS,RNS_CF_M,RNS_CF_U,RNS_CF_AMT,RNS_CF_MS,RNS_CF_US,RNS_CF_AS,\"; query += \" RNS_MRP_M,RNS_MRP_U,COLL_MODE,RECPT_CODE,RECEPT_NO,COLL_DATE,COLL_AMT,NON_PRECP,NON_PRECNO,\"; query += \" NON_PAMT,NON_PDATE,RCDC_AMT,TYPE_RCDC,RCDC_DATE,R_REC_CODE,R_REC_NO,REBATE_ALL,NO_REC,NO_RECON,\"; query += \" COLL_AMTON,TYPE_BILL,COLL_BODY,TR_ABEENG,TR_ABEDPS,ADJ_ENG,ADJ_DUTY,ADJ_DPS,ADJ_UNIT,BADJ_ENG,\"; query += \" BADJ_DPS,BADJ_DUTY,CADJ_ENG,CADJ_DUTY,CADJ_DP S,TROD_ENG,TROD_DUTY,TROD_DPS,TROD_ABENG,TROD_ABDPS,\"; query += \" REM_CORR,REM_METER,REM_FPPCA,LEG_STATUS,LEG_DATE,PAY_MODE,L_PAY,L_PAYDT,L_RECNO,P_CENGCH,P_CDUTY,\"; query += \" P_CDPS,P_AENGCH,P_ADUTY,P_ADPS,P_NENG,P_NDUTY,P_NDPS,DOC,DIV,SUB_DIV,SECTION,METER_NO,METER_CAP,\"; query += \" CAP_CH,MR_MF,STATUS_DT,SD_INST,ERR,PHASE,MRP_DATE,MTR_STAT,READ_STAT,CON_STAT,LINE_STAT,TR_NO,\"; query += \" POLE_NO,ROUT_NO,LDB_MON,TBB_MON,LDR_MON,TBR_MON,MRPB_MON,SRCB_MON,CATC_MON,LOADC_MON,NAMEC_MON,NARR_MON,AREA_CODE,\"; query += \" ID_AREA,ID_NO,FLAG_NSRC,FLAG_RCDC,FLAG_DC,FLAG_MRP,FLAG_BNP,FLAG_LNP,FLAG_BP,FLAG_LP,\"; query += \" FEE_NAME,FEE_TYPE,FEE_CODE,INT_SD,TDS_SD,BOOK_NO,DUE_AREA,PSS, L1_UNIT, L2_UNIT, L3_UNIT, L4_UNIT,L1_MONTH, L2_MONTH, L3_MONTH, L4_MONTH\"; query += \" ) \"; que ry += \" values \"; query += \" ( \"; query += \" \" + SBPDCL_EnergyBillID + \",’\" + CON_ACNO + \"’,’\" + CON_LOC + \"’,’\" + CON_NO + \"’,\" + CAT_CODE + \",’\" + CAT + \"’,’\" + CAT_SUB + \"’,’\" + CAT_METER + \"’,’\" + FEDER_TYPE + \"’,\" + LOAD_SAN + \",\" + LOAD_CON + \",\" + MD + \",’\" + MD_TAR + \"’,\"; query += \" ’\" + PR_TAR + \"’,’\" + NAME + \"’,’\" + F_H_NAME + \"’,’\" + ADDRESS + \"’,’\" + ADDRESS_1 + \"’,’\" + CON_STATUS + \"’,’\" + READ_DATE + \"’,’\" + LREAD_DATE + \"’,\" + PAST_READ + \",\" + PR_READ + \",\"; query += \" \" + UNIT_CON + \",\" + MIN_UNIT + \",\" + UNIT_CH + \",\" + ADD_UNIT + \",\" + TEMP_READ + \",\" + MRP_READ + \",\" + FREE_UNIT + \",\" + FREE_ENG + \",\" + AVG_READ + \",’\" + DATE_AVG + \"’,\"; query += \" \" + MC_MONTH + \",\" + MC_UNIT + \",\" + NO_BILLMON + \",\" + NO_RENTMON + \",\" + ENG_CHARGE + \",\" + ENG_AC_C H + \",\" + FIX_CHARGE + \",\" + MTR_RENTCH + \",’\" + M_RENT_APP + \"’,\"; query += \" \" + DPS + \",\" + FPFCA + \",\" + FPPCA + \",\" + CAP_CHARGE + \",\" + MCB_CHARGE + \",\" + MIS_CHARGE + \",\" + ELEC_DUTY + \",\" + PFS + \",\" + OTHER_CH + \",\" + TOT_ASST + \",\" + GRAND_TOT + \",\"; query += \" \" + REBATE + \",\" + REBATE_PF + \",\" + NET_AMT + \",\" + GRACE_AMT + \",\" + LESS_CR + \",’\" + BL_BASIS + \"’,\" + BILL_CYCLE + \",’\" + BILL_DATE + \"’,’\" + DUE_DATE + \"’,’\" + BILL_MONTH + \"’,\"; query += \" ’\" + GRACE_DATE + \"’,’\" + F_DATE + \"’,’\" + T_DATE + \"’,\" + ARR_DUTY + \",\" + ARR_ENG + \",\" + ARR_DPS + \",\" + ARR_PFS + \",\" + ARR_DPSPFS + \",\" + ARR_ABENG + \",\" + ARR_ABDPS + \",\"; query += \" \" + CF_DUTY + \",\" + CF_ENG + \",\" + CF_DPS + \",\" + CF_PFS + \",\" + CF_DPSPFS + \",\" + CF_ABENG + \",\" + CF_ABDPS + \",\" + RNS_ARR_M + \",\" + RNS_ARR_U + \",\" + RNS_ARR_AM + \",\"; query += \" \" + RNS_ARR_MS + \",\" + RNS_ARR_US + \",\" + RNS_ARR_AS + \",\" + RNS_CF_M + \",\" + RNS_CF_U + \",\" + RNS_CF_AMT + \",\" + RNS_CF_MS + \",\" + RNS_CF_US + \",\" + RNS_CF_AS + \",\"; query += \" \" + RNS_MRP_M + \",\" + RNS_MRP_U + \",’\" + COLL_MODE + \"’,’\" + RECPT_CODE + \"’,\" + RECEPT_NO + \",’\" + COLL_DATE + \"’,\" + COLL_AMT + \",’\" + NON_PRECP + \"’,\" + NON_PRECNO + \",\"; query += \" \" + NON_PAMT + \",’\" + NON_PDATE + \"’,\" + RCDC_AMT + \",\" + TYPE_RCDC + \",’\" + RCDC_DATE + \"’,’\" + R_REC_CODE + \"’,\" + R_REC_NO + \",\" + REBATE_ALL + \",\" + NO_REC + \",\" + NO_RECON + \",\"; query += \" \" + COLL_AMTON + \",’\" + TYPE_BILL + \"’,’\" + COLL_BODY + \"’,\" + TR_ABEENG + \",\" + TR_ABEDPS + \",\" + ADJ_ENG + \",\" + ADJ_DUTY + \",\" + ADJ_DPS + \",\" + ADJ_UNIT + \",\" + BADJ_ENG + \",\"; query += \" \" + BADJ_DPS + \",\" + BADJ_DUTY + \",\" + CADJ_ENG + \",\" + CADJ_DUTY + \",\" + CADJ_DPS + \",\" + TROD_ENG + \",\" + TROD_DUTY + \",\" + TROD_DPS + \",\" + TROD_ABENG + \",\" + TROD_ABDPS + \",\"; query += \" ’\" + REM_CORR + \"’,’\" + REM_METER + \"’,’\" + REM_FPPCA + \"’,\" + LEG_STATUS + \",’\" + LEG_DATE + \"’,\" + PAY_MODE + \",\" + L_PAY + \",’\" + L_PAYDT + \"’,’\" + L_RECNO + \"’,\" + P_CENGCH + \",\" + P_CDUTY + \",\"; query += \" \" + P_CDPS + \",\" + P_AENGCH + \",\" + P_ADUTY + \",\" + P_ADPS + \",\" + P_NENG + \",\" + P_NDUTY + \",\" + P_NDPS + \",’\" + DOC + \"’,’\" + DIV + \"’,’\" + SUB_DIV + \"’,’\" + SECTION + \"’,’\" + METER_NO + \"’,’\" + METER_CAP + \"’,\"; query += \" ’\" + CAP_CH + \"’,\" + MR_MF + \",’\" + STATUS_DT + \"’,\" + SD_INST + \",’\" + ERR + \"’,\" + PHASE + \",’\" + MRP_DATE + \"’,\" + MTR_STAT + \",\" + READ_STAT + \",\" + CON_STAT + \",\" + LINE_STAT + \",’\" + TR_NO + \"’,\"; query += \" ’\" + POLE_NO + \"’,’\" + ROUT_NO + \"’,’\" + LDB_MON + \"’,’\" + TBB_MON + \"’,’\" + LDR_MON + \"’,’\" + TBR_MON + \"’,’ \" + MRPB_MON + \"’,’\" + SRCB_MON + \"’,’\" + CATC_MON + \"’,’\" + LOADC_MON + \"’,’\" + NAMEC_MON + \"’,’\" + NARR_MON + \"’,’\" + AREA_CODE + \"’,\"; query += \" ’\" + ID_AREA + \"’,\" + ID_NO + \",’\" + FLAG_NSRC + \"’,’\" + FLAG_RCDC + \"’,’\" + FLAG_DC + \"’,’\" + FLAG_MRP + \"’,’\" + FLAG_BNP + \"’,’\" + FLAG_LNP + \"’,’\" + FLAG_BP + \"’,’\" + FLAG_LP + \"’,\"; query += \" ’\" + FEE_NAME + \"’,’\" + FEE_TYPE + \"’,’\" + FEE_CODE + \"’,\" + INT_SD + \",\" + TDS_SD + \",’\" + BOOK_NO + \"’,’\" + DUE_AREA + \"’,’\" + PSS + \"’,\" + L1_UNIT + \",\" + L2_UNIT + \",\" + L3_UNIT + \",\" + L4_UNIT + \",’\" + L1_MONTH + \"’,’\" + L2_MONTH + \"’,’\" + L3_MONTH + \"’,’\" + L4_MONTH + \"’\"; query += \" ) \"; forTran(query); } oconn.Close(); if (chkProc == 1) { tran.Commit(); lblExcept.Text = \"Process Completed\"; txtTitle.Text = \"\"; txtSheetName.Text = \"\"; txtRemarks.Text = \"\"; txtTitle.Focus(); if (Convert.ToInt32(con.State) >= 1) { con.Close(); } } else { tram = 0; throw new Exception(\"Error\"); } }", oconn); oconn.Open(); OleDbDataReader odr = ocmd.ExecuteReader(); while (odr.Read()) { SBPDCL_EnergyBillID = ScratchMaxid("NBPDCL_EnergyBill", "did"); CON_ACNO = valid(odr, 0); CON_LOC = valid(odr, 1); CON_NO = valid(odr, 2); CAT_CODE = valid(odr, 3); CAT = valid(odr, 4); CAT_SUB = valid(odr, 5); CAT_METER = valid(odr, 6); FEDER_TYPE = valid(odr, 7); LOAD_SAN = valid(odr, 8); LOAD_CON = valid(odr, 9); MD = valid(odr, 10); MD_TAR = valid(odr, 11); PR_TAR = valid(odr, 12); NAME = valid(odr, 13); F_H_NAME = valid(odr, 14); ADDRESS = valid(odr, 15); ADDRESS_1 = valid(odr, 16); CON_STATUS = valid(odr, 17); READ_DATE = valid(odr, 18); LREAD_DATE = valid(odr, 19); PAST_READ = valid(odr, 20); PR_READ = valid(odr, 21); UNIT_CON = valid(odr, 22); MIN_UNIT = valid(odr, 23); UNIT_CH = valid(odr, 24); ADD_UNIT = valid(odr, 25); TEMP_READ = valid(odr, 26); MRP_READ = valid(odr, 27); FREE_UNIT = valid(odr, 28); FREE_ENG = valid(odr, 29); AVG_READ = valid(odr, 30); DATE_AVG = valid(odr, 31); MC_MONTH = valid(odr, 32); MC_UNIT = valid(odr, 33); NO_BILLMON = valid(odr, 34); NO_RENTMON = valid(odr, 35); ENG_CHARGE = valid(odr, 36); ENG_AC_CH = valid(odr, 37); FIX_CHARGE = valid(odr, 38); MTR_RENTCH = valid(odr, 39); M_RENT_APP = valid(odr, 40); DPS = valid(odr, 41); FPFCA = valid(odr, 42); FPPCA = valid(odr, 43); CAP_CHARGE = valid(odr, 44); MCB_CHARGE = valid(odr, 45); MIS_CHARGE = valid(odr, 46); ELEC_DUTY = valid(odr, 47); PFS = valid(odr, 48); OTHER_CH = valid(odr, 49); TOT_ASST = valid(odr, 50); GRAND_TOT = valid(odr, 51); REBATE = valid(odr, 52); REBATE_PF = valid(odr, 53); NET_AMT = valid(odr, 54); GRACE_AMT = valid(odr, 55); LESS_CR = valid(odr, 56); BL_BASIS = valid(odr, 57); BILL_CYCLE = valid(odr, 58); BILL_DATE = valid(odr, 59); DUE_DATE = valid(odr, 60); BILL_MONTH = valid(odr, 61); GRACE_DATE = valid(odr, 62); F_DATE = valid(odr, 63); T_DATE = valid(odr, 64); ARR_DUTY = valid(odr, 65); ARR_ENG = valid(odr, 66); ARR_DPS = valid(odr, 67); ARR_PFS = valid(odr, 68); ARR_DPSPFS = valid(odr, 69); ARR_ABENG = valid(odr, 70); ARR_ABDPS = valid(odr, 71); CF_DUTY = valid(odr, 72); CF_ENG = valid(odr, 73); CF_DPS = valid(odr, 74); CF_PFS = valid(odr, 75); CF_DPSPFS = valid(odr, 76); CF_ABENG = valid(odr, 77); CF_ABDPS = valid(odr, 78); RNS_ARR_M = valid(odr, 79); RNS_ARR_U = valid(odr, 80); RNS_ARR_AM = valid(odr, 81); RNS_ARR_MS = valid(odr, 82); RNS_ARR_US = valid(odr, 83); RNS_ARR_AS = valid(odr, 84); RNS_CF_M = valid(odr, 85); RNS_CF_U = valid(odr, 86); RNS_CF_AMT = valid(odr, 87); RNS_CF_MS = valid(odr, 88); RNS_CF_US = valid(odr, 89); RNS_CF_AS = valid(odr, 90); RNS_MRP_M = valid(odr, 91); RNS_MRP_U = valid(odr, 92); COLL_MODE = valid(odr, 93); RECPT_CODE = valid(odr, 94); RECEPT_NO = valid(odr, 95); COLL_DATE = valid(odr, 96); COLL_AMT = valid(odr, 97); NON_PRECP = valid(odr, 98); NON_PRECNO = valid(odr, 99); NON_PAMT = valid(odr, 100); NON_PDATE = valid(odr, 101); RCDC_AMT = valid(odr, 102); TYPE_RCDC = valid(odr, 103); RCDC_DATE = valid(odr, 104); R_REC_CODE = valid(odr, 105); R_REC_NO = valid(odr, 106); REBATE_ALL = valid(odr, 107); NO_REC = valid(odr, 108); NO_RECON = valid(odr, 109); COLL_AMTON = valid(odr, 110); TYPE_BILL = valid(odr, 111); COLL_BODY = valid(odr, 112); TR_ABEENG = valid(odr, 113); TR_ABEDPS = valid(odr, 114); ADJ_ENG = valid(odr, 115); ADJ_DUTY = valid(odr, 116); ADJ_DPS = valid(odr, 117); ADJ_UNIT = valid(odr, 118); BADJ_ENG = valid(odr, 119); BADJ_DPS = valid(odr, 120); BADJ_DUTY = valid(odr, 121); CADJ_ENG = valid(odr, 122); CADJ_DUTY = valid(odr, 123); CADJ_DPS = valid(odr, 124); TROD_ENG = valid(odr, 125); TROD_DUTY = valid(odr, 126); TROD_DPS = valid(odr, 127); TROD_ABENG = valid(odr, 128); TROD_ABDPS = valid(odr, 129); REM_CORR = valid(odr, 130); REM_METER = valid(odr, 131); REM_FPPCA = valid(odr, 132); LEG_STATUS = valid(odr, 133); LEG_DATE = valid(odr, 134); PAY_MODE = valid(odr, 135); L_PAY = valid(odr, 136); L_PAYDT = valid(odr, 137); L_RECNO = valid(odr, 138); P_CENGCH = valid(odr, 139); P_CDUTY = valid(odr, 140); P_CDPS = valid(odr, 141); P_AENGCH = valid(odr, 142); P_ADUTY = valid(odr, 143); P_ADPS = valid(odr, 144); P_NENG = valid(odr, 145); P_NDUTY = valid(odr, 146); P_NDPS = valid(odr, 147); DOC = valid(odr, 148); DIV = valid(odr, 149); SUB_DIV = valid(odr, 150); SECTION = valid(odr, 151); METER_NO = valid(odr, 152); METER_CAP = valid(odr, 153); CAP_CH = valid(odr, 154); MR_MF = valid(odr, 155); STATUS_DT = valid(odr, 156); SD_INST = valid(odr, 157); ERR = valid(odr, 158); PHASE = valid(odr, 159); MRP_DATE = valid(odr, 160); MTR_STAT = valid(odr, 161); READ_STAT = valid(odr, 162); CON_STAT = valid(odr, 163); LINE_STAT = valid(odr, 164); TR_NO = valid(odr, 165); POLE_NO = valid(odr, 166); ROUT_NO = valid(odr, 167); LDB_MON = valid(odr, 168); TBB_MON = valid(odr, 169); LDR_MON = valid(odr, 170); TBR_MON = valid(odr, 171); MRPB_MON = valid(odr, 172); SRCB_MON = valid(odr, 173); CATC_MON = valid(odr, 174); LOADC_MON = valid(odr, 175); NAMEC_MON = valid(odr, 176); NARR_MON = valid(odr, 177); AREA_CODE = valid(odr, 178); ID_AREA = valid(odr, 179); ID_NO = valid(odr, 180); FLAG_NSRC = valid(odr, 181); FLAG_RCDC = valid(odr, 182); FLAG_DC = valid(odr, 183); FLAG_MRP = valid(odr, 184); FLAG_BNP = valid(odr, 185); FLAG_LNP = valid(odr, 186); FLAG_BP = valid(odr, 187); FLAG_LP = valid(odr, 188); FEE_NAME = valid(odr, 189); FEE_TYPE = valid(odr, 190); FEE_CODE = valid(odr, 191); INT_SD = valid(odr, 192); TDS_SD = valid(odr, 193); BOOK_NO = valid(odr, 194); DUE_AREA = valid(odr, 195); PSS = valid(odr, 196); L1_UNIT = valid(odr, 197); L2_UNIT = valid(odr, 198); L3_UNIT = valid(odr, 199); L4_UNIT = valid(odr, 200); L1_MONTH = valid(odr, 201); L2_MONTH = valid(odr, 202); L3_MONTH = valid(odr, 203); L4_MONTH = valid(odr, 204); if (READ_DATE == "0") { READ_DATE = ""; } if (LREAD_DATE == "0") { LREAD_DATE = ""; } if (DATE_AVG == "0") { DATE_AVG = ""; } if (BILL_DATE == "0") { BILL_DATE = ""; } if (DUE_DATE == "0") { DUE_DATE = ""; } if (BILL_MONTH == "0") { BILL_MONTH = ""; } if (GRACE_DATE == "0") { GRACE_DATE = ""; } if (F_DATE == "0") { F_DATE = ""; } if (T_DATE == "0") { T_DATE = ""; } if (COLL_DATE == "0") { COLL_DATE = ""; } if (NON_PDATE == "0") { NON_PDATE = ""; } if (RCDC_DATE == "0") { RCDC_DATE = ""; } if (LEG_DATE == "0") { LEG_DATE = ""; } if (L_PAYDT == "0") { L_PAYDT = ""; } if (DOC == "0") { DOC = ""; } if (STATUS_DT == "0") { STATUS_DT = ""; } if (MRP_DATE == "0") { MRP_DATE = ""; } query = ""; query += " insert into NBPDCL_EnergyBill "; query += " ( "; query += " did,CON_ACNO,CON_LOC,CON_NO,CAT_CODE,CAT,CAT_SUB,CAT_METER,FEDER_TYPE,LOAD_SAN,LOAD_CON,MD,MD_TAR,"; query += " PR_TAR,NAME,F_H_NAME,ADDRESS,ADDRESS_1,CON_STATUS,READ_DATE,LREAD_DATE,PAST_READ,PR_READ,"; query += " UNIT_CON,MIN_UNIT,UNIT_CH,ADD_UNIT,TEMP_READ,MRP_READ,FREE_UNIT,FREE_ENG,AVG_READ,DATE_AVG,"; query += " MC_MONTH,MC_UNIT,NO_BILLMON,NO_RENTMON,ENG_CHARGE,ENG_AC_CH,FIX_CHARGE,MTR_RENTCH,M_RENT_APP,"; query += " DPS,FPFCA,FPPCA,CAP_CHARGE,MCB_CHARGE,MIS_CHARGE,ELEC_DUTY,PFS,OTHER_CH,TOT_ASST,GRAND_TOT,"; query += " REBATE,REBATE_PF,NET_AMT,GRACE_AMT,LESS_CR,BL_BASIS,BILL_CYCLE,BILL_DATE,DUE_DATE,BILL_MONTH,"; query += " GRACE_DATE,F_DATE,T_DATE,ARR_DUTY,ARR_ENG,ARR_DPS,ARR_PFS,ARR_DPSPFS,ARR_ABENG,ARR_ABDPS,"; query += " CF_DUTY,CF_ENG,CF_DPS,CF_PFS,CF_DPSPFS,CF_ABENG,CF_ABDPS,RNS_ARR_M,RNS_ARR_U,RNS_ARR_AM,"; query += " RNS_ARR_MS,RNS_ARR_US,RNS_ARR_AS,RNS_CF_M,RNS_CF_U,RNS_CF_AMT,RNS_CF_MS,RNS_CF_US,RNS_CF_AS,"; query += " RNS_MRP_M,RNS_MRP_U,COLL_MODE,RECPT_CODE,RECEPT_NO,COLL_DATE,COLL_AMT,NON_PRECP,NON_PRECNO,"; query += " NON_PAMT,NON_PDATE,RCDC_AMT,TYPE_RCDC,RCDC_DATE,R_REC_CODE,R_REC_NO,REBATE_ALL,NO_REC,NO_RECON,"; query += " COLL_AMTON,TYPE_BILL,COLL_BODY,TR_ABEENG,TR_ABEDPS,ADJ_ENG,ADJ_DUTY,ADJ_DPS,ADJ_UNIT,BADJ_ENG,"; query += " BADJ_DPS,BADJ_DUTY,CADJ_ENG,CADJ_DUTY,CADJ_DPS,TROD_ENG,TROD_DUTY,TROD_DPS,TROD_ABENG,TROD_ABDPS,"; query += " REM_CORR,REM_METER,REM_FPPCA,LEG_STATUS,LEG_DATE,PAY_MODE,L_PAY,L_PAYDT,L_RECNO,P_CENGCH,P_CDUTY,"; query += " P_CDPS,P_AENGCH,P_ADUTY,P_ADPS,P_NENG,P_NDUTY,P_NDPS,DOC,DIV,SUB_DIV,SECTION,METER_NO,METER_CAP,"; query += " CAP_CH,MR_MF,STATUS_DT,SD_INST,ERR,PHASE,MRP_DATE,MTR_STAT,READ_STAT,CON_STAT,LINE_STAT,TR_NO,"; query += " POLE_NO,ROUT_NO,LDB_MON,TBB_MON,LDR_MON,TBR_MON,MRPB_MON,SRCB_MON,CATC_MON,LOADC_MON,NAMEC_MON,NARR_MON,AREA_CODE,"; query += " ID_AREA,ID_NO,FLAG_NSRC,FLAG_RCDC,FLAG_DC,FLAG_MRP,FLAG_BNP,FLAG_LNP,FLAG_BP,FLAG_LP,"; query += " FEE_NAME,FEE_TYPE,FEE_CODE,INT_SD,TDS_SD,BOOK_NO,DUE_AREA,PSS, L1_UNIT, L2_UNIT, L3_UNIT, L4_UNIT,L1_MONTH, L2_MONTH, L3_MONTH, L4_MONTH"; query += " ) "; query += " values "; query += " ( "; query += " " + SBPDCL_EnergyBillID + ",'" + CON_ACNO + "','" + CON_LOC + "','" + CON_NO + "'," + CAT_CODE + ",'" + CAT + "','" + CAT_SUB + "','" + CAT_METER + "','" + FEDER_TYPE + "'," + LOAD_SAN + "," + LOAD_CON + "," + MD + ",'" + MD_TAR + "',"; query += " '" + PR_TAR + "','" + NAME + "','" + F_H_NAME + "','" + ADDRESS + "','" + ADDRESS_1 + "','" + CON_STATUS + "','" + READ_DATE + "','" + LREAD_DATE + "'," + PAST_READ + "," + PR_READ + ","; query += " " + UNIT_CON + "," + MIN_UNIT + "," + UNIT_CH + "," + ADD_UNIT + "," + TEMP_READ + "," + MRP_READ + "," + FREE_UNIT + "," + FREE_ENG + "," + AVG_READ + ",'" + DATE_AVG + "',"; query += " " + MC_MONTH + "," + MC_UNIT + "," + NO_BILLMON + "," + NO_RENTMON + "," + ENG_CHARGE + "," + ENG_AC_CH + "," + FIX_CHARGE + "," + MTR_RENTCH + ",'" + M_RENT_APP + "',"; query += " " + DPS + "," + FPFCA + "," + FPPCA + "," + CAP_CHARGE + "," + MCB_CHARGE + "," + MIS_CHARGE + "," + ELEC_DUTY + "," + PFS + "," + OTHER_CH + "," + TOT_ASST + "," + GRAND_TOT + ","; query += " " + REBATE + "," + REBATE_PF + "," + NET_AMT + "," + GRACE_AMT + "," + LESS_CR + ",'" + BL_BASIS + "'," + BILL_CYCLE + ",'" + BILL_DATE + "','" + DUE_DATE + "','" + BILL_MONTH + "',"; query += " '" + GRACE_DATE + "','" + F_DATE + "','" + T_DATE + "'," + ARR_DUTY + "," + ARR_ENG + "," + ARR_DPS + "," + ARR_PFS + "," + ARR_DPSPFS + "," + ARR_ABENG + "," + ARR_ABDPS + ","; query += " " + CF_DUTY + "," + CF_ENG + "," + CF_DPS + "," + CF_PFS + "," + CF_DPSPFS + "," + CF_ABENG + "," + CF_ABDPS + "," + RNS_ARR_M + "," + RNS_ARR_U + "," + RNS_ARR_AM + ","; query += " " + RNS_ARR_MS + "," + RNS_ARR_US + "," + RNS_ARR_AS + "," + RNS_CF_M + "," + RNS_CF_U + "," + RNS_CF_AMT + "," + RNS_CF_MS + "," + RNS_CF_US + "," + RNS_CF_AS + ","; query += " " + RNS_MRP_M + "," + RNS_MRP_U + ",'" + COLL_MODE + "','" + RECPT_CODE + "'," + RECEPT_NO + ",'" + COLL_DATE + "'," + COLL_AMT + ",'" + NON_PRECP + "'," + NON_PRECNO + ","; query += " " + NON_PAMT + ",'" + NON_PDATE + "'," + RCDC_AMT + "," + TYPE_RCDC + ",'" + RCDC_DATE + "','" + R_REC_CODE + "'," + R_REC_NO + "," + REBATE_ALL + "," + NO_REC + "," + NO_RECON + ","; query += " " + COLL_AMTON + ",'" + TYPE_BILL + "','" + COLL_BODY + "'," + TR_ABEENG + "," + TR_ABEDPS + "," + ADJ_ENG + "," + ADJ_DUTY + "," + ADJ_DPS + "," + ADJ_UNIT + "," + BADJ_ENG + ","; query += " " + BADJ_DPS + "," + BADJ_DUTY + "," + CADJ_ENG + "," + CADJ_DUTY + "," + CADJ_DPS + "," + TROD_ENG + "," + TROD_DUTY + "," + TROD_DPS + "," + TROD_ABENG + "," + TROD_ABDPS + ","; query += " '" + REM_CORR + "','" + REM_METER + "','" + REM_FPPCA + "'," + LEG_STATUS + ",'" + LEG_DATE + "'," + PAY_MODE + "," + L_PAY + ",'" + L_PAYDT + "','" + L_RECNO + "'," + P_CENGCH + "," + P_CDUTY + ","; query += " " + P_CDPS + "," + P_AENGCH + "," + P_ADUTY + "," + P_ADPS + "," + P_NENG + "," + P_NDUTY + "," + P_NDPS + ",'" + DOC + "','" + DIV + "','" + SUB_DIV + "','" + SECTION + "','" + METER_NO + "','" + METER_CAP + "',"; query += " '" + CAP_CH + "'," + MR_MF + ",'" + STATUS_DT + "'," + SD_INST + ",'" + ERR + "'," + PHASE + ",'" + MRP_DATE + "'," + MTR_STAT + "," + READ_STAT + "," + CON_STAT + "," + LINE_STAT + ",'" + TR_NO + "',"; query += " '" + POLE_NO + "','" + ROUT_NO + "','" + LDB_MON + "','" + TBB_MON + "','" + LDR_MON + "','" + TBR_MON + "','" + MRPB_MON + "','" + SRCB_MON + "','" + CATC_MON + "','" + LOADC_MON + "','" + NAMEC_MON + "','" + NARR_MON + "','" + AREA_CODE + "',"; query += " '" + ID_AREA + "'," + ID_NO + ",'" + FLAG_NSRC + "','" + FLAG_RCDC + "','" + FLAG_DC + "','" + FLAG_MRP + "','" + FLAG_BNP + "','" + FLAG_LNP + "','" + FLAG_BP + "','" + FLAG_LP + "',"; query += " '" + FEE_NAME + "','" + FEE_TYPE + "','" + FEE_CODE + "'," + INT_SD + "," + TDS_SD + ",'" + BOOK_NO + "','" + DUE_AREA + "','" + PSS + "'," + L1_UNIT + "," + L2_UNIT + "," + L3_UNIT + "," + L4_UNIT + ",'" + L1_MONTH + "','" + L2_MONTH + "','" + L3_MONTH + "','" + L4_MONTH + "'"; query += " ) "; forTran(query); } oconn.Close(); if (chkProc == 1) { tran.Commit(); lblExcept.Text = "Process Completed"; txtTitle.Text = ""; txtSheetName.Text = ""; txtRemarks.Text = ""; txtTitle.Focus(); if (Convert.ToInt32(con.State) >= 1) { con.Close(); } } else { tram = 0; throw new Exception("Error"); } } 这篇关于如何在C#按钮单击时将精确数据从excel传输到Sql 2005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!