Click here to Skip to main content
15,881,516 members
Home / Discussions / C#
   

C#

 
GeneralAssertion in C# app Pin
ip_tgz28-Jan-04 20:23
ip_tgz28-Jan-04 20:23 
GeneralRe: Assertion in C# app Pin
Mazdak28-Jan-04 20:55
Mazdak28-Jan-04 20:55 
GeneralRe: Assertion in C# app Pin
ip_tgz28-Jan-04 22:58
ip_tgz28-Jan-04 22:58 
GeneralRe: Assertion in C# app Pin
Mazdak29-Jan-04 0:02
Mazdak29-Jan-04 0:02 
GeneralRe: Assertion in C# app Pin
Heath Stewart29-Jan-04 2:47
protectorHeath Stewart29-Jan-04 2:47 
Generalcontrolling devices in c# Pin
mahmoud12328-Jan-04 20:11
mahmoud12328-Jan-04 20:11 
GeneralRe: controlling devices in c# Pin
Heath Stewart29-Jan-04 2:42
protectorHeath Stewart29-Jan-04 2:42 
GeneralSecond Time Slow Code Pin
obelisk2928-Jan-04 16:59
obelisk2928-Jan-04 16:59 
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.

C#
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...
GeneralRe: Second Time Slow Code Pin
Le centriste28-Jan-04 18:19
Le centriste28-Jan-04 18:19 
GeneralRe: Second Time Slow Code Pin
obelisk2929-Jan-04 4:44
obelisk2929-Jan-04 4:44 
GeneralRe: Second Time Slow Code Pin
Colin Angus Mackay29-Jan-04 14:48
Colin Angus Mackay29-Jan-04 14:48 
GeneralDataAdapters Pin
MrJJKoolJ28-Jan-04 13:54
MrJJKoolJ28-Jan-04 13:54 
GeneralRe: DataAdapters Pin
Christian Graus28-Jan-04 15:47
protectorChristian Graus28-Jan-04 15:47 
GeneralRe: DataAdapters Pin
MrJJKoolJ28-Jan-04 16:22
MrJJKoolJ28-Jan-04 16:22 
GeneralRe: DataAdapters Pin
Christian Graus28-Jan-04 16:27
protectorChristian Graus28-Jan-04 16:27 
GeneralControls using the form designer Pin
James Simpson28-Jan-04 12:12
James Simpson28-Jan-04 12:12 
GeneralRe: Controls using the form designer Pin
James Simpson28-Jan-04 12:28
James Simpson28-Jan-04 12:28 
Generalthreding Pin
nadeen ali28-Jan-04 10:56
nadeen ali28-Jan-04 10:56 
GeneralRe: threding Pin
Heath Stewart28-Jan-04 11:32
protectorHeath Stewart28-Jan-04 11:32 
GeneralProtecting a CD or DVD from copy Pin
antoine@orchus-tech28-Jan-04 10:05
antoine@orchus-tech28-Jan-04 10:05 
GeneralRe: Protecting a CD or DVD from copy Pin
Heath Stewart28-Jan-04 11:24
protectorHeath Stewart28-Jan-04 11:24 
GeneralRe: Protecting a CD or DVD from copy Pin
Kentamanos28-Jan-04 11:28
Kentamanos28-Jan-04 11:28 
QuestionHow to record keyboard Pin
jacal9928-Jan-04 9:25
jacal9928-Jan-04 9:25 
AnswerRe: How to record keyboard Pin
Mazdak28-Jan-04 9:43
Mazdak28-Jan-04 9:43 
GeneralRe: How to record keyboard Pin
jacal9928-Jan-04 9:54
jacal9928-Jan-04 9:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.