c# - Method runs for every instance of the method -


I am trying to set my ASP line and cell color in my data class based on my method. I have color set and method running. The method gives the true or false based on the terms given below How can I stop the procedure by running multiple times? For example, if it runs once and returns properly, then it runs again from "" to lineNum and brandNum With the count packed as the same number as the first part of the field. This method was processed to run once for every instance of call call. Then when I actually call the law again, then everything runs again, why is it running more than once and how can I fix it?

  Output: LineNum: 123 Brand Num: 456 Pack Pack: 15 Seconds Run (Not Asked) Line: "Brand Name" "To Decide What's Right:  
  SqlParameter [] parameters = new SQLParamator [] {new SQLPamator ("@Jenanum 6", item number):  

, new escalpimeter ("@Genatax 9 ", Brand New)}; {Reader = App_Code.DBHelper.executeQuery (try dbConn, sqlString.ToString (), parameters); If (reader.HasRows) {while (reader.Read ()) {PackCount = reader ["PackCount"] ToString (); }} Reader. Stop it (); Reader.Dispose (); DbConn.Close (); DbConn.Dispose (); } Hold (Exceptional) {East; } Finally {if (dbConn! = Null) {try {dbConn.Close (); DbConn.Dispose (); } Hold {}} if (reader! = Null) {try {reader.Close (); Reader.Dispose (); } Hold {}}} if (convert. ToInt32 (PackCount) <= 12) {return true; } Other {return false; }

call:

  if (lineData.PacksLeft1 (L1.Text, L2.Text)) {myTable.Rows [1]. Cell [0 ]. Bgciller = "# ef2a 2e"; MyTable.Rows [1]. Game [1]. Bgciller = "# ef2a 2e"; MyTable.Rows [1]. Game [2] .bgColor = "# FE2E2E"; MyTable.Rows [1]. Game [3] .bgColor = "# FE2E2E"; }  

There is no need for the final description because it does the same action attempt Performed in the statement. I believe that after seeing this piece, if you are being called back, you can take it in one catch, you can do the same thing. I recommend taking

  reader.Close (); Reader.Dispose (); DbConn.Close (); DbConn.Dispose ();  

Try leaving the statement out of the block and in the end, it does not matter, the results are displayed, these items are displayed.

is ultimately used only when you are trying something after using the code, in which the attempt statement is already in the form of:

  try {// Try this statement, if it works, then run it} hold {// error occurred} Finally {// failed or failed in the attempt to run this code}  

Comments