requests = db.myds("select vch_company from jf_branch where vchlx='加盟店'");
                int g0 = 1;
                for (g0 = 1; g0 <= num; g0++)
                {                    dataGridView14.Rows[g0 - 1].Cells["日期"].Value = i + g0 - 1 + "日";                    string dt = Convert.ToString(this.dateTimePicker28.Value);//年月日时分秒 
                    DateTime dt0 = Convert.ToDateTime(dt);
                    dt = dt0.AddDays(+g0 - 1).ToString("yyyy-MM-dd");//当前日期前一日                    string kss = dt + " 00:00:00";
                    string jss = dt + " 23:59:59";                    DataGridViewRow row0 = new DataGridViewRow();
                    dataGridView14.Rows.Add(row0);                    for (int i0 = 0; i0 < ut; i0++)
                    {                        string uu = requests.Tables[0].Rows[i0][0].ToString().Trim();
                        string sti = "select ch_branchno from t_hq_branch_info where vch_company='" + uu + "'";
                        string oo = db.RunSqlReturn1(sti);
                        string stu = "Select sum ( a.num_realamount ) from cyhq_u_checkout_detail a , cyhq_u_checkout_master b where a.ch_payno =b.ch_payno and a.ch_paymodeno ='00' and ( b.ch_state ='Y' ) and a.dt_operdate >= '" + kss + " ' and a.dt_operdate <= '" + jss + "' and a.ch_branchno =b.ch_branchno and b.ch_branchno ='" + oo + "'";                        string ssss = db.RunSqlReturn1(stu);
                        if (ssss == "")
                        {
                            ssss = "0";
                        }
                        dataGridView14.Rows[g0 - 1].Cells["column" + i0.ToString()].Value = ssss;                    }
                                   }
能看懂吗,怎么优化下,查询速度非常慢