Hello, I get this error: System.IndexOutOfRangeException: 2000 I've got a table this table in excel:
Month 2000 2001 2002 2003
1 180.4 194.3 209.0 236.4
2 181.1 195.2 212.2 237.9
3 182.4 196.3 213.1 238.7
4 184.1 197.4 216.5 240.1
5 185.4 198.6 219.4 240.2
6 186.1 199.0 220.7 240.7 (up to 2013)
7 187.7 200.1 224.5 241.1
8 189.2 200.5 227.0 241.0
9 189.8 201.0 228.2 240.8
10 190.6 201.9 230.5 240.8
11 191.6 203.0 231.9 240.5
12 192.2 203.9 232.8 240.4
private void Database()
{
string strConnString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|calculator2.mdb";
DateTime e59 = tenderDate;
DateTime e61 = e59.AddDays(14);
DateTime f61 = e61.AddDays(-15);
int h61 = f61.Month;
int i61 = f61.Year;
OleDbConnection con = new OleDbConnection(strConnString);
con.Open();
string strQuery2 = "select " + i61 + " from JBBC where Month=" + h61;
OleDbCommand cmd2 = new OleDbCommand(strQuery2, con);
OleDbDataReader reader2 = cmd2.ExecuteReader();
reader2.Read();
string yr2000 = reader2["2000"].ToString();
string yr2001 = reader2["2001"].ToString();
string yr2002 = reader2["2002"].ToString();
string yr2003 = reader2["2003"].ToString();
string yr2004 = reader2["2004"].ToString();
string yr2005 = reader2["2005"].ToString();
string yr2006 = reader2["2006"].ToString();
string yr2007 = reader2["2007"].ToString();
string yr2008 = reader2["2008"].ToString();
string yr2009 = reader2["2009"].ToString();
string yr2010 = reader2["2010"].ToString();
string yr2011 = reader2["2011"].ToString();
string yr2012 = reader2["2012"].ToString();
string yr2013 = reader2["2013"].ToString();
reader2.Close();
con.Close();
}