All pastes #278178 Raw Edit

Someone

public text v1 · immutable
·published 2006-12-13 22:05 UTC
rendered paste body
public string count_bar_total_suppliers()
        {
            string TotalSupplier = "0";
            try
            {
                System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection();
                sqlConnection.ConnectionString = Connection_String_Club_Data;
                System.Data.SqlClient.SqlCommand sqlCommand = new System.Data.SqlClient.SqlCommand();
                sqlCommand.Connection = sqlConnection;
                sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
                sqlCommand.CommandText = "count_bar_total_suppliers";
                sqlCommand.Connection.Open();
                System.Data.SqlClient.SqlDataReader myReader = sqlCommand.ExecuteReader();
                
                while (myReader.Read())
                {
                    TotalSupplier = myReader["Column1"].ToString();
                }
             
             
                sqlCommand.Connection.Close();
                sqlCommand.Connection.Dispose();
                sqlCommand.Dispose();
                myReader.Close();
                myReader.Dispose();
                return TotalSupplier;
            }
            catch (Exception ex)
            {
                // Print error message
                System.Windows.Forms.MessageBox.Show(ex.Message); return TotalSupplier;
            }