prisilla jayaraj

prisilla jayaraj

  • NA
  • 35
  • 100.8k

array index outof range error?

Mar 9 2011 3:41 AM
Index was outside the bounds of the array ,why this error occur?
while i executing this i am facing that error

this is my coding
con.Open();
str = "select heading from newsmain12 where groupname='" + dr + "'";
cmd = new SqlCommand(str, con);
cmd.CommandType = CommandType.Text;
SqlDataReader odr = cmd.ExecuteReader();
while (odr.Read() == true)
{
idm += odr[0].ToString() + ",";
}
string[] ids1 = idm.Split(',');

if (ids1[0] != null)
{
Session["id1"] = ids1[0].ToString();
string m = Session["id1"].ToString();
}
if (ids1[1] != null)
{
Session["ids2"] = ids1[1].ToString();
string m1 = Session["ids2"].ToString();
}
else
{
}








Answers (4)