我正在使用 C Sharp
运行调试器以查看 wat 代码错误后出现此错误:
{“位置 5 处没有行。”} System.Exception {System.IndexOutOfRangeException}
public DataSet FindData(string ID, string pass)
{
InitializeConnection();
m_oCn.Open();
DataSet thisDataSet = new DataSet();
DataSet foundDataSet = new DataSet();
try
{
m_oDA.Fill (thisDataSet, "Login");
for (int n = 0; 0 < thisDataSet.Tables["Login"].Rows.Count ; n++)
{
if (thisDataSet.Tables["Login"].Rows[n]["UserName"].ToString () == ID)
{
if (thisDataSet.Tables["Login"].Rows[n]["Password"].ToString () == pass)
{
m_oDA.Fill(foundDataSet,n,1,"Login");
}
}
}
}
catch
{
}
finally
{
m_oCn.Close();
m_oCn = null;
}
return foundDataSet;