“System.ArgumentNullException”类型的第一次机会异常在 mscorlib.dll 中发生 其他信息: 值不能为 null

这个问题该怎么解决呢 1 #region//向PFXJ表中插入Ln项集,并返回Ln,参数为Ln的后选项(Cn) 2 public string[,] LnInsertToPFXJ(string[,] L, int minSupport) 3 { 4 int hang = L.GetLength(0); 5 int lie = L.GetLength(1); 6 7 string[,] Cn = new string[hang, lie]; 8 int max = 0;//得到的Ln的实际行数 9 10 for (int i = 0; i < hang; i++) 11 { 12 StreamReader sr = new StreamReader("My.txt", Encoding.GetEncoding("gb2312")); 13 string line = string.Empty; 14 int zhiChiPinDu = 0; 15 int num = 0;//用来判断是否二维数组的行中元素满足条件 16 string strLn = string.Empty;//存候选项集元素 17 while ((line = sr.ReadLine()) != null) 18 { 19 for( 20 21 int j = 0; j < lie; j++) 22 { 23 if (line.Contains(L[i, j]))/*此处抛出异常,对应堆栈中的中的> HouseSale.exe!HouseSale.Apriori.LnInsertToPFXJ(string[,] L, int minSupport) 行 294 C#*/ 24 { 25 int lineLen = line.Length; 26 if (L[i, j].Length == 3 && lineLen > 3 && (line.Substring(lineLen - 4, 1) == "I")) 27 { 28 int len = line.IndexOf(L[i, j]); 29 string str = line.Substring(len + 3, 1); 30 if (str == "I") 31 { 32 num += 1; 33 } 34 } 35 else 36 { 37 num += 1; 38 } 39 } 40 } 41 if (num == lie) 42 { 43 zhiChiPinDu += 1; 44 } 45 num = 0; 46 } 47 sr.Close(); 48 if (zhiChiPinDu >= minSupport) 49 { 50 for (int j = 0; j < lie; j++) 51 { 52 strLn += (L[i, j] + ","); 53 54 } 55 strLn = strLn.Substring(0, strLn.Length - 1); 56 string sql = "insert into PFXJ values('" + lie.ToString() + "','" + strLn + "','" + zhiChiPinDu.ToString() + "')"; 57 ErpApplication erp = new ErpApplication(); 58 59 erp.Esql(sql); 60 61 62 max += 1; 63 64 string myStr = string.Empty; 65 for (int j = 0; j < lie; j++) 66 { 67 if (strLn.Contains(",")) 68 { 69 int dLen = strLn.IndexOf(","); 70 myStr = strLn.Substring(0, dLen); 71 72 Cn[max - 1, j] = myStr; 73 strLn = strLn.Substring(dLen + 1, strLn.Length - dLen - 1); 74 } 75 else 76 { 77 Cn[max - 1, j] = strLn; 78 } 79 } 80 } 81 82 strLn = string.Empty; 83 } 调用堆栈如下: [外部代码] > HouseSale.exe!HouseSale.Apriori.LnInsertToPFXJ(string[,] L, int minSupport) 行 294 C# HouseSale.exe!HouseSale.Apriori.MyApriori(string[] Id, int minSupport) 行 169 C# HouseSale.exe!HouseSale.DigDataForm.button5_Click(object sender, System.EventArgs e) 行 97 C# [外部代码] HouseSale.exe!HouseSale.ChooseForm.button5_Click(object sender, System.EventArgs e) 行 205 C# [外部代码] HouseSale.exe!HouseSale.Program.Main() 行 21 C# [外部代码]
慕码人8056858
浏览 905回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP