Mat*_*001 2 c# sql indexoutofboundsexception
Time =(DateTime) AllQuestionsPresented.TryParse(dr["Time"].ToString());
Run Code Online (Sandbox Code Playgroud)
哪里dr
是SqlReader.
我得到了一个IndexOutOfRangeException
,我不知道为什么.这是TryParse函数:
public static DateTime? TryParse(string text)
{
DateTime date;
if (DateTime.TryParse(text, out date))
{
return date;
}
else
{
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
我不明白为什么我得到那个例外,我怎么能摆脱它?!