使用水晶报表碰到“CrystalDecisions. CrystalReports.Engine.ReportDocument”的类型初始值设定项引发异常

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

忽然有一天在VS2005中调试时蹦出上面这样的异常提示,经过跟踪确定是执行ReportDocument类构造函数时抛出,除此之外,提示里并没有给出更有用的信息了。
但是在运行程序(注意不是在VS2005里按F5那种调试)时,虽然也跳出了同样的异常,但给出的提示却帮我找到了原因。
异常文本如下:
System.TypeInitializationException: “CrystalDecisions.CrystalReports.Engine.ReportDocument”的类型初始值设定项引发异常。 ---> System.Configuration.ConfigurationErrorsException: 配置系统未能初始化 ---> System.Configuration.ConfigurationErrorsException: 无法识别的配置节 userSettings。 (E:/Documents and Settings/yy/Local Settings/Application Data/LT/NmsClientC.exe_Url_a53bgatewzs2vles2gjwnykacqm4mj5m/1.0.0.0/user.config line 3)
 

提示我用户配置文件user.config出现了不能被软件识别的配置节,我猜测ReportDocument类在实例化的时候读取了user.config,却发现一些不能消化的垃圾在里面,就崩溃了。
问题很快搞清楚了,之前我是将软件中最后一次使用者的登录名之类的数据保存在user.conifg文件中,后来改变主意转而保存在数据库中,就在昨天我把所有用户配置条目都清除,但是之前软件运行时产生的user.config文件中依然存储着这些数据,但对软件来讲,user.config中的配置节已不能识别,所以出现上面的异常。
把E:/Documents and Settings/yy/Local Settings/Application Data/LT/NmsClientC.exe_Url_a53bgatewzs2vles2gjwnykacqm4mj5m/1.0.0.0/user.config文件删除问题即解决。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

// 2016/2/21 10:32 准备再次解答这个问题了。小学的时候使用人工枚举方法,这个我不擅长!现在决定用程序来解决了! // 2016/2/22 16:26 代码优化整理完成!!!! // 给你一个高难度的题目。 // 有一个14位数。 // 由 2个1 2个2 2个3 2个4 2个5 2个6 2个7组成 // 其中。两个1中有一个数字。 // 2个2中有2个数字 // 2个3中有3个数字 // 2个4中有4个数字 // 2个5中有5个数字。 // 2个6中有6个数字。 // 2个7中有7个数字 // // 请给出一个 这样的14位数字(总数大于10个。给一个即可!) // 这是我小学6年级的时候的 奥数考题! #include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> int main(void) { unsigned char ucArray[15] = {0}; // int i = 0; // for(i=1; i<15; i++) // { // printf("*ucArray[%d]=%d\n", i, ucArray[i]); // } // 2016/2/21 11:10 第一位数字完成 int bit01 = 0; for(bit01=1; bit01<=7; bit01++) { unsigned char ucArray01[15] = {0}; int temp01 = 0; for(temp01=0; temp01<15; temp01++) { ucArray01[temp01] = ucArray[temp01]; } ucArray01[1] = bit01; ucArray01[1+bit01+1] = bit01; // for(temp01=1; temp01<15; temp01++) // { // printf("%d=%d ", temp01, ucArray01[temp01]); // } // // printf("*1\n"); // 2016/2/21 11:33 第二位数字完成 int bit02 = 0; for(bit02=1; bit02<=7; bit02++) { unsigned char ucArray02[15] = {0}; int temp02 = 0; for(temp02=0; temp02<15; temp02++) { ucArray02[temp02] = ucArray01[temp02]; } // 2016/2/21 11:17 需要判断第2位数字 和 接着的数字必须没有被占用。还有就是不能重复。 if(0==ucArray02[2]) { for(temp02=1; temp02<15; temp02++) { if(ucArray02[temp02]>0) { // continue; if(ucArray02[temp02]==bit02) { temp02 = 99; break; } } } if(temp02>15) { continue; } if(0==ucArray02[2+bit02+1]) { ucArray02[2] = bit02; ucArray02[2+bit02+1] = bit02; } else { continue; } } // for(temp02=1; temp02<15; temp02++) // { // printf("%d=%d ", temp02, ucArray02[temp02]); // } // // printf("*2\n"); // 2016/2/21 20:18 第三位数字完工 int bit03 = 0; for(bit03=1; bit03<=7; bit03++) { unsigned char ucArray03[15] = {0}; int temp03 = 0; for(temp03=0; temp03<15; temp03++) { ucArray03[temp03] = ucArray02[temp03]; } // 2016/2/21 11:17 需要判断第2位数字 和 接着的数字必须没有被占用。还有就是不能重复 if(0==ucArray03[3]) { for(temp03=0; temp03<15; temp03++) { if(ucArray03[temp03]>0) { if(ucArray03[temp03]==bit03) { // continue; temp03 = 99; break; } } } if(temp03>15) { continue; } if(0==ucArray03[3+bit03+1]) { ucArray03[3] = bit03; ucArray03[3+bit03+1] = bit03; } else { continue; } } else { bit03 = 8; } // for(temp03=1; temp03<15; temp03++) // { // printf("%d=%d ", temp03, ucArray03[temp03]); // } // // printf("*3\n"); // 2016/2/21 20:18 第四位数字(将所有的03替换为04,还有就是02替换为03) int bit04 = 0; for(bit04=1; bit04<=7; bit04++) { unsigned char ucArray04[15] = {0}; int temp04 = 0; for(temp04=0; temp04<15; temp04++) { ucArray04[temp04] = ucArray03[temp04]; } // 2016/2/21 11:17 需要判断第2位数字 和 接着的数字必须没有被占用。还有就是不能重复 if(0==ucArray04[4]) { for(temp04=1; temp04<15; temp04++) { if(ucArray04[temp04]>0) { if(ucArray04[temp04]==bit04) { // continue; temp04 = 99; break; } } } if(temp04>15) { continue; } if(0==ucArray04[4+bit04+1]) { ucArray04[4] = bit04; ucArray04[4+bit04+1] = bit04; } else { continue; } } else { bit04 = 8; } // for(temp04=1; temp04<15; temp04++) // { // printf("%d=%d ", temp04, ucArray04[temp04]); // } // // printf("*4\n"); // 2016/2/21 20:30 第5位数字 int bit05 = 0; for(bit05=1; bit05<=7; bit05++) { unsigned char ucArray05[15] = {0}; int temp05 = 0; for(temp05=0; temp05<15; temp05++) { ucArray05[temp05] = ucArray04[temp05]; } // 2016/2/21 11:17 需要判断第2位数字 和 接着的数字必须没有被占用。还有就是不能重复 if(0==ucArray05[5]) { for(temp05=1; temp05<15; temp05++) { if(ucArray05[temp05]>0) { if(ucArray05[temp05]==bit05) { // continue; temp05 = 99; break; } } } if(temp05>15) { continue; } if(0==ucArray05[5+bit05+1]) { ucArray05[5] = bit05; ucArray05[5+bit05+1] = bit05; } else { continue; } } else { bit05 = 8; } // for(temp05=1; temp05<15; temp05++) // { // printf("%d=%d ", temp05, ucArray05[temp05]); // } // // printf("*5\n"); // 2016/2/21 20:38 第6位数字 int bit06 = 0; for(bit06=1; bit06<=7; bit06++) { unsigned char ucArray06[15] = {0}; int temp06 = 0; for(temp06=0; temp06<15; temp06++) { ucArray06[temp06] = ucArray05[temp06]; } if(0==ucArray06[6]) { for(temp06=1; temp06<15; temp06++) { if(ucArray06[temp06]>0) { if(ucArray06[temp06]==bit06) { temp06 = 99; break; } } } // 2016/2/22 12:20 清除重复数字 if(temp06>15) { continue; } if(0==ucArray06[6+bit06+1]) { ucArray06[6] = bit06; ucArray06[6+bit06+1] = bit06; } else { continue; } } else { bit06 = 8; } // for(temp06=1; temp06<15; temp06++) // { // printf("%d=%d ", temp06, ucArray06[temp06]); // } // // printf("*6\n"); // 2016/2/21 21:52 第7位数字 int bit07 = 0; for(bit07=1; bit07<=7; bit07++) { unsigned char ucArray07[15] = {0}; int temp07 = 0; for(temp07=0; temp07<15; temp07++) { ucArray07[temp07] = ucArray06[temp07]; } // 2016/2/22 12:24 使用新的逻辑 if(0==ucArray07[7]) { for(temp07=1; temp07<15; temp07++) { if(ucArray07[temp07]>0) { if(ucArray07[temp07]==bit07) { temp07 = 99; break; } } } // 2016/2/22 12:20 清除重复数字 if(temp07>15) { continue; } if((7+bit07+1)>14) { continue; } if(0==ucArray07[7+bit07+1]) { // 357436 25427161* 漏了这一句 ucArray07[7] = bit07; ucArray07[7+bit07+1] = bit07; } else { continue; } } else { bit07 = 8; } // for(temp07=1; temp07<15; temp07++) // { // printf("%d=%d ", temp07, ucArray07[temp07]); // } // // printf("*7\n"); // 2016/2/21 21:58 第8个数字 int bit08 = 0; for(bit08=1; bit08<=7; bit08++) { unsigned char ucArray08[15] = {0}; int temp08 = 0; for(temp08=0; temp08<15; temp08++) { ucArray08[temp08] = ucArray07[temp08]; } if(0==ucArray08[8]) { for(temp08=1; temp08<15; temp08++) { if(ucArray08[temp08]>0) { if(ucArray08[temp08]==bit08) { temp08 = 99; break; } } } if(temp08>15) { continue; } // 2016/2/22 11:42 数组越界检查(超过14位了) if((8+bit08+1)>14) { continue; } if(0==ucArray08[8+bit08+1]) { ucArray08[8] = bit08; ucArray08[8+bit08+1] = bit08; } } else { bit08 = 8; } // for(temp08=1; temp08<15; temp08++) // { // printf("%d=%d ", temp08, ucArray08[temp08]); // } // // printf("*8\n"); // 2016/2/21 22:03 第9位数字 填字的话只剩下这种情况(最后六位:431614):xxxxxxxx431614 int bit09 = 0; // for(bit09=1; bit09<=7; bit09++) for(bit09=1; bit09<=4; bit09++) { unsigned char ucArray09[15] = {0}; int temp09 = 0; for(temp09=0; temp09<15; temp09++) { ucArray09[temp09] = ucArray08[temp09]; } if(0==ucArray09[9]) { for(temp09=1; temp09<15; temp09++) { if(ucArray09[temp09]>0) { if(ucArray09[temp09]==bit09) { temp09 = 99; break; } } } if(temp09>15) { continue; } // 2016/2/22 11:42 数组越界检查(超过14位了) if((9+bit09+1)>14) { continue; } if(0==ucArray09[9+bit09+1]) { ucArray09[9] = bit09; ucArray09[9+bit09+1] = bit09; } } else { bit09 = 8; } // for(temp09=1; temp09<15; temp09++) // { // printf("%d=%d ", temp09, ucArray09[temp09]); // } // // printf("*9\n"); // 2016/2/21 22:08 第10位数字 填字的话只剩下这种情况(最后五位:31213):xxxxxxxxx31213 int bit10 = 0; // for(bit10=1; bit10<=7; bit10++) for(bit10=1; bit10<=3; bit10++) { unsigned char ucArray10[15] = {0}; int temp10 = 0; for(temp10=0; temp10<15; temp10++) { ucArray10[temp10] = ucArray09[temp10]; } if(0==ucArray10[10]) { for(temp10=1; temp10<15; temp10++) { if(ucArray10[temp10]>0) { if(ucArray10[temp10]==bit10) { temp10 = 99; break; } } } if(temp10>15) { continue; } // 2016/2/22 11:42 数组越界检查(超过14位了) if((10+bit10+1)>14) { continue; } if(0==ucArray10[10+bit10+1]) { ucArray10[10] = bit10; ucArray10[10+bit10+1] = bit10; } } else { bit10 = 8; } // for(temp10=1; temp10<15; temp10++) // { // printf("%d=%d ", temp10, ucArray10[temp10]); // } // // printf("*10\n"); // 2016/2/21 22:15 第11位数字 填字的话只剩下这种情况(最后四位:2162):xxxxxxxxxx2162 int bit11 = 0; // for(bit11=1; bit11<=7; bit11++) for(bit11=1; bit11<=2; bit11++) { unsigned char ucArray11[15] = {0}; int temp11 = 0; for(temp11=0; temp11<15; temp11++) { ucArray11[temp11] = ucArray10[temp11]; } if(0==ucArray11[11]) { for(temp11=1; temp11<15; temp11++) { if(ucArray11[temp11]>0) { if(ucArray11[temp11]==bit11) { temp11 = 99; break; } } } if(temp11>15) { continue; } if((11+bit11+1)>14) { continue; } if(0==ucArray11[11+bit11+1]) { ucArray11[11] = bit11; ucArray11[11+bit11+1] = bit11; } else { continue; } } else { bit11 = 8; } for(temp11=1; temp11<12; temp11++) { if(0==ucArray11[temp11]) { temp11 = 88; break; } } if(temp11>15) { continue; } // for(temp11=1; temp11<15; temp11++) // { // printf("%d=%d ", temp11, ucArray11[temp11]); // } // // printf("*11\n"); // 2016/2/21 22:44 第12位数字 填字的话只剩下这种情况(最后三位:161):35743625427161 int bit12 = 0; // for(bit12=1; bit12<=7; bit12++) for(bit12=1; bit12<=1; bit12++) { unsigned char ucArray12[15] = {0}; int temp12 = 0; for(temp12=0; temp12<15; temp12++) { ucArray12[temp12] = ucArray11[temp12]; } if(0==ucArray12[12]) { // 2016/2/22 15:17 1617245263 4753 for(temp12=1; temp12<15; temp12++) { if(ucArray12[temp12]>0) { if(ucArray12[temp12]==bit12) { temp12 = 99; break; } } } if(temp12>15) { continue; } if((12+bit12+1)>14) { continue; } if(0==ucArray12[12+bit12+1]) { ucArray12[12] = bit12; ucArray12[12+bit12+1] = bit12; } else { continue; } } else { bit12 = 8; } // 2016/2/22 11:29 去掉 数字中有零的输出:35673415164700 // for(temp12=1; temp12<13; temp12++) for(temp12=1; temp12<15; temp12++) { if(0==ucArray12[temp12]) { temp12 = 88; break; } } if(temp12>15) { continue; } for(temp12=1; temp12<15; temp12++) { // printf("%d=%d ", temp12, ucArray12[temp12]); printf("%d", ucArray12[temp12]); } printf("*12\n"); } } } } } } } } } } } } return 0; } 14156742352637 14167345236275 15146735423627 15163745326427 15167245236473 15173465324726 16135743625427 16172452634753 17125623475364 17126425374635 23627345161475 23726351417654 24723645317165 25623745361417 26325734615147 26327435614175 26721514637543 27423564371516 34573641512762 34673245261715 35723625417164 35743625427161 36713145627425 37463254276151 41617435263275 41716425327635 45671415362732 46171435623725 46171452632753 46357432652171 51716254237643 52462754316137 52472654131763 52642753461317 52732653417164 53647352462171 53672352461714 56171354632742 57141653472362 57236253471614 57263254376141 57416154372632 61517346532472 62742356437151 71316435724625 71416354732652 72452634753161 72462354736151 72632453764151 73161345726425 73625324765141 74151643752362
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值