I have a collection of about 3,500 product serial number, which is used to make about 10 times reported in my software Week Does.
My code comes from a very flat database (looks excel spreadsheets) where it pulls 0 to 25+ records from one table for each serial number. I pass this data with a It takes about 20 minutes to run this report that many data is limited by the requests being sent for the year SQL 2000 server , but in the form of a stable class More string manipulations and data conversion were written to reduce as possible. I want to write to try and speed up the race, but I do not understand how your routine can be fulfilled. Here I have done regularly the simplified version: The task is to write the code in parallel. For loop All of my examples are far too straightforward, and do not provide any information about how to change my code. Even so far I have it, but the second Obviously, I want to start the array with something (not a Can anyone help please? me the static method which makes an example of my
CustomClass , and stores that archives end in a collection.
private Kstmclas [] Test 1 (string [] serial number) {List & lt; Custom Class & gt; List = new list & lt; Custom Class & gt; (); For (int i = 0; i & lt; serial number; height; i ++) {datatell table = new datatable (); Using (SqlCommand cmd = new SqlCommand ( "sp_GetData", m_open_conn)) {cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add ("@ sn", SqlDbType.Char, 20) .Value = serialNumber [i]; Table.Load (cmd.ExecuteReader ()); } List Add (CustomClass.CreateSummary (table)); } Return List. Tore (); }
0 value (one of my action / funk statement)
by type to 'int' Jp2code.CustomClass' ... and I really do not know what exactly I need to do this job.
Private custom class [] Test 1 (string [] serial number) {List & lt; Custom Class & gt; List = new list & lt; Custom Class & gt; (); Parallel.For & LT; CustomClass & gt; (0, serialNumbers.Length, () = & gt; 0, (i loop, inventory) = & gt; {DataTable table = new DataTable (); (using SqlCommand cmd = new SqlCommand ( "sp_GetData", m_open_conn )) {cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add ( "@ sn", SqlDbType.Char, 20) .Value = serialnumber [i]; table.Load (cmd.ExecuteReader ()); }}, (X) = & gt; Add List (CustomClass.CreateSummary (table)); Return list Tore (); }
0 ), but I do not know what to really do here. / P>
parallel. To change the
loop to just
loop, you should be able to:
private custom class [] Test 1 (string [] serial number) {List & lt; Custom Class & gt; List = new list & lt; Custom Class & gt; (); Parallel.For (0, serialNumber.Length (i) => {DataTable table = New DataTable (); (SqlCommand cmd = Use new SqlCommand ("sp_GetData", m_open_conn)) {cmd.CommandType = CommandType.StoredProcedure ; cmd .Parameters.Add ( "@ sn", SqlDbType.Char, 20) .Value = serialnumber [i]; table.Load (cmd.ExecuteReader ());} list.Add (CustomClass.CreateSummary (table ));}); Return list Tore (); }
Comments
Post a Comment