Hi! I wrote this code in class.cs. But I want call it’s from default.aspx.cs
public ArrayList GetInfos(string NAM)
{
ArrayList list = null;
if (ViewState["ArrayData"] == null)
{
list = new ArrayList();
string str = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
SqlConnection con = new SqlConnection(str);
SqlCommand cmd = new SqlCommand("SELECT SURNAME,NAM,LASTNAME,BIRTHDAY,ADDRESS FROM INFO WHERE NAM=" + NAM, con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while (rdr.Read())
{
list.Add(string.Join(";", rdr["SURNAME"], rdr["NAM"], rdr["LASTNAME"], rdr["BIRTHDAY"], rdr["ADDRESS"]));
}
ViewState["ArrayData"] = list;
}
else
{
list = ViewState["ArrayData"] as ArrayList;
}
return list;
}