behroz1387
شنبه 19 اردیبهشت 1388, 01:05 صبح
دوستان عزيز باور كنيد زياد جستجو كردم اما به نتيجه اي نريسيدم اگه مي شه كدي كه در زير آوردم را كه براي ارتباط با اكسس است براي ارتباط با sql تبديل كنيد ممنون مي شم اگه كسي كمك كنه
crystalReportViewer1 .DataBindings .Clear ();
string s1, s2;
s1 = "Provider = Microsoft.Jet.OLEDB.4.0;" + " Data Source = D:\\1111\\tara.mdb;" + " Persist Security Info = True ;" + " Jet OLEDB:Database Password = bm";
OleDbConnection con = new OleDbConnection(s1);
con.Open();
s2 = " Select tara.[a],tara.[b],tara.[c],tara.[d],tara.[f],tara.[g] from tara where (tara.[d]) >= " + "'" + (maskedTextBox1.Text) + "'" + " and (tara.[d])<= " + "'" + (maskedTextBox2.Text) + "'" + " and (tara.g]) = " + "'" + (textBox1.Text) + "'" + " and tara.[g]= " + "'" + (textBox2.Text) + "'";
OleDbDataAdapter da = new OleDbDataAdapter(s2, con);
DataTable dt = new DataTable();
da.Fill(dt);
CrystalReport5 cr = new CrystalReport5();
cr.SetDataSource(dt);
crystalReportViewer1.ReportSource = cr;
crystalReportViewer1 .DataBindings .Clear ();
string s1, s2;
s1 = "Provider = Microsoft.Jet.OLEDB.4.0;" + " Data Source = D:\\1111\\tara.mdb;" + " Persist Security Info = True ;" + " Jet OLEDB:Database Password = bm";
OleDbConnection con = new OleDbConnection(s1);
con.Open();
s2 = " Select tara.[a],tara.[b],tara.[c],tara.[d],tara.[f],tara.[g] from tara where (tara.[d]) >= " + "'" + (maskedTextBox1.Text) + "'" + " and (tara.[d])<= " + "'" + (maskedTextBox2.Text) + "'" + " and (tara.g]) = " + "'" + (textBox1.Text) + "'" + " and tara.[g]= " + "'" + (textBox2.Text) + "'";
OleDbDataAdapter da = new OleDbDataAdapter(s2, con);
DataTable dt = new DataTable();
da.Fill(dt);
CrystalReport5 cr = new CrystalReport5();
cr.SetDataSource(dt);
crystalReportViewer1.ReportSource = cr;