How can i filter data between to dates in visual studio 2008 report viewer in C#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Here is my code plz help...
What sql query to use in my dataset to retrieve data between two dates in report viewer in vs 2008?????
i used two combo boxes..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace lawise
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
SqlConnection cs = new SqlConnection("SERVER=ALI-PC\SQLEXPRESS; DATABASE=TIPU; Trusted_Connection = True");
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM MAMA", cs);
DataTable dt = new DataTable();










da.Fill(dt);



for (int i = 0; i < dt.Rows.Count; i++)
{
comboBox1.Items.Add(dt.Rows["DATE"]); //////DATE is the column name which data loaded in combo boxes

}




da.Fill(dt);

for (int i = 0; i < dt.Rows.Count; i++)
{
comboBox2.Items.Add(dt.Rows["DATE"]);



}


}

private void btn1_Click(object sender, EventArgs e)
{
// TODO: This line of code loads data into the DataSet1.mama table. You can move, or remove it, as needed.
this.mamaTableAdapter.Fill(this.DataSet1.mama, Convert.ToDateTime(comboBox1.SelectedItem));
this.mamaTableAdapter.FillBy(this.DataSet1.mama, Convert.ToDateTime(comboBox2.SelectedItem));
this.reportViewer1.RefreshReport();
}
}
}

View the full article
 
Back
Top