1) It loads extremely slow, takes over 20 seconds, but it does load the DataBase. Is that normal?
2) I put the hello and bye response to test if it connected well. It writes hello and bye numerous of times like hellohellohellohello...byebyebyebye... is this normal? I was thinking this has something to do with question 3.
3) When I comment out the catch(exception) I get an error saying InvalidOperationException "timeout expired." I think catch was good for catching those occasional errors, not the same error over and over. I think that means something is wrong?
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection Conn = new SqlConnection("Data Source=aserver;Initial Catalog=KennyCust;Persist Security Info=True;user id=sa;pwd=qwerty01");
SqlDataReader rdr = null;
string commandString = "SELECT * FROM MainDB";
string commandString2 = "SELECT * From DetailDB";
try
{
Conn.Open();
SqlCommand Cmd = new SqlCommand(commandString, Conn);
SqlDataAdapter sdp = new SqlDataAdapter(Cmd);
DataSet ds = new DataSet();
if (Conn != null)
{
Response.Write("Hello");
}
ds.Clear();
sdp.Fill(ds);
MasterCust.DataSource = ds.Tables[0];
MasterCust.DataBind();
}
catch (Exception)
{
}
finally
{
if (rdr != null)
{
rdr.Close();
}
if (Conn != null)
{
Conn.Close();
if (Conn != null)
{
Response.Write("Bye");
}
}
}