所以我试图从文本文件读取并将每个字段存储到数组中。但是,当我试图将accountNumber转换为Int时,出现错误。尝试转换时的格式异常
public bool matchCustomer(int accountID){
string[] data = null;
string line = Global.currentFile.reader.ReadLine();
while (line != null)
{
data = line.Split('*');
this.accountNumber = Convert.ToInt32(data[0]);
line = Global.currentFile.reader.ReadLine();
if (accountID == this.accountNumber)
{
return true;
}
}
return false;
}
什么错误,什么是'数据[0]'的价值? – Steve
错误显示“输入字符串格式不正确”。 data [0]的值是12345.文本文件的第一行是12345 * Shrek * 1209 * 100,000 * 50,000 –
如果这些值都是数字,那么有没有更多10位数的值? (具体地说,大于'2,147,483,647') –