fa_te64
جمعه 05 مهر 1387, 10:23 صبح
من برنامه اي نوشتم كه در آن با بانك اطلاعاتي sqlexpress ارتباط داره،و در زمان لود فرم به بانك جوين شده و اطلاعات را در ديتا گريد ميريزه(به وسيله ي كد نويسي) اما سرعت باز شدن فرم خيلي پايينه،فكر كنم كد من استاندارد نباشه كه اينقدر با سرعت پايين لود ميشه
مينويسمش،لطفا بگين مشكلش كجاست؟
this.fatTableTableAdapter.Fill(this.factDBDataSet. FatTable);
lblTime.Text = System.DateTime.Now.Hour.ToString() + " : " + System.DateTime.Now.Minute.ToString() + " : " + System.DateTime.Now.Second.ToString();
dt.Clear();
string conStr = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + System.IO.Directory.GetCurrentDirectory().Substrin g(0, System.IO.Directory.GetCurrentDirectory().Length - 10) + "\\FactiiiDB.mdf;Integrated (file://\\FactiiiDB.mdf;Integrated) Security=True;User Instance=True";
SqlConnection cn = new SqlConnection(conStr);
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "select code as [رديف],Name as [نام کالا],Count as [تعداد],Price as[مبلغ],TotalPrice as[مبلغ کل],Description as [توضيحات] from " + dataset.Tables[0].ToString();
cn.Open();
SqlDataReader reader = cmd.ExecuteReader();
dt.Load(reader);
cn.Close();
dataGrdView.DataSource = dt;
dataGrdView.RefreshEdit();
dataGrdView.Columns[dataGrdView.Columns.Count - 1].Width = 300;
و اين هم كدي كه براي ارتباط پايگاه با كريستال ريپورت نوشتم
this.fatTableTableAdapter.Fill(this.factDBDataSet. FatTable);
string CurPath = System.IO.Directory.GetCurrentDirectory();
if (CurPath.Substring(CurPath.Length) == "")
{
CurPath = CurPath.Substring(0, CurPath.Length - 10);
}
CurPath = CurPath + "\\CrystalReport1.rpt (file://\\CrystalReport1.rpt)";
reportDocument1.Load(CurPath);
factiiiDBDataSet = fncGetData();
reportDocument1.SetDataSource(factiiiDBDataSet.Tab les[0] );
crystalReportViewer.ReportSource = reportDocument1;
مينويسمش،لطفا بگين مشكلش كجاست؟
this.fatTableTableAdapter.Fill(this.factDBDataSet. FatTable);
lblTime.Text = System.DateTime.Now.Hour.ToString() + " : " + System.DateTime.Now.Minute.ToString() + " : " + System.DateTime.Now.Second.ToString();
dt.Clear();
string conStr = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + System.IO.Directory.GetCurrentDirectory().Substrin g(0, System.IO.Directory.GetCurrentDirectory().Length - 10) + "\\FactiiiDB.mdf;Integrated (file://\\FactiiiDB.mdf;Integrated) Security=True;User Instance=True";
SqlConnection cn = new SqlConnection(conStr);
SqlCommand cmd = new SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "select code as [رديف],Name as [نام کالا],Count as [تعداد],Price as[مبلغ],TotalPrice as[مبلغ کل],Description as [توضيحات] from " + dataset.Tables[0].ToString();
cn.Open();
SqlDataReader reader = cmd.ExecuteReader();
dt.Load(reader);
cn.Close();
dataGrdView.DataSource = dt;
dataGrdView.RefreshEdit();
dataGrdView.Columns[dataGrdView.Columns.Count - 1].Width = 300;
و اين هم كدي كه براي ارتباط پايگاه با كريستال ريپورت نوشتم
this.fatTableTableAdapter.Fill(this.factDBDataSet. FatTable);
string CurPath = System.IO.Directory.GetCurrentDirectory();
if (CurPath.Substring(CurPath.Length) == "")
{
CurPath = CurPath.Substring(0, CurPath.Length - 10);
}
CurPath = CurPath + "\\CrystalReport1.rpt (file://\\CrystalReport1.rpt)";
reportDocument1.Load(CurPath);
factiiiDBDataSet = fncGetData();
reportDocument1.SetDataSource(factiiiDBDataSet.Tab les[0] );
crystalReportViewer.ReportSource = reportDocument1;