string dsource = @"C:\Users\Comma\Desktop\Working ON\WebBasedData\WebBasedData\Data\Attachments_20131219"; //Put your datasource path in the connection string for example if you have csv files in D:\ directory change datasource= D:\ string constr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dsource + ";Extended Properties='text;HDR=Yes;FMT=Delimited';"; try { txtFromDate1.Text = Convert.ToString("MMDDYY"); txtToDate1.Text = Convert.ToString("MMDDYY"); string fromdate = txtFromDate1.Text; string todate = txtToDate1.Text; string fromtime = DropDownList2.SelectedItem.Text; string totime = DropDownList3.SelectedItem.Text; con.ConnectionString = constr; //create instance for command object OleDbCommand cmd = new OleDbCommand(); cmd.Connection = con; // set your file name in the below query cmd.CommandText = "select * from [fpyield && fromdate && fromtime ]" ; //Open Oledb Connection to read CSV file con.Open(); //Create one datatable to store data from CSV file DataTable dt = new DataTable(); // Load Data into the datatable dt.Load(cmd.ExecuteReader()); //Bind data in the Gridview GridViewShow.DataSource = dt; GridViewShow.DataBind();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)