Hello I am using Sql Server 2000 Developer Edition, Now I know there are limitations too how many connections you have BUT This piece of code below executes a whole lot slower the second time you run it.
switch(cbSearch.SelectedItem.ToString())
{
case "Lastname":
cmd = new SqlCommand("SPSearchRmiInfoLastname", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Lastname", txtSearch.Text);
break;
case "Firstname":
cmd = new SqlCommand("SPSearchRmiInfoFirstname", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Firstname", txtSearch.Text);
break;
}
conn.Open();
Search.Clear();
SqlDataReader drd = cmd.ExecuteReader();
while(drd.Read())
{
Search.Rows.Add(new object\[\] {drd\[0\], drd\[1\], drd\[2\], drd\[3\]});
sbp.Text = Search.Rows.Count+" records found.";
}
dg.DataSource = Search;
drd.Close();
conn.Close();
The results are staggering. First time: 1783 Milliseconds Second time: 150326 Milliseconds HOLY SHAZBOT!! Now that's a difference right there, Any ideas on why this is happening and how I can change it Thanks, Obe NOTE: I already posted this in the Sql/ADO/ADO.NET Section but it has todo with C# as well ------------------ I'm naked under my clothes...