基于Web的数据管理 [英] Web-Based data management

查看:95
本文介绍了基于Web的数据管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OleDbConnection con = new OleDbConnection();
 
//Your datasource Location path currently i placed D drive location 
string dsource = @"D:\Working \WebBasedData\WebBasedData\Data\Attachments_";
 
//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
{
    con.ConnectionString = constr;
 
    //create instance for command object 
    OleDbCommand cmd = new OleDbCommand();
 
    cmd.Connection = con;
 
 
    // set your file name in the below query
      select * from [fpyield 12162013 1030.csv]
      select * from [fpyield 12162013 0930.csv]
      select * from [fpyield 12162013 0830.csv]
 
   
    //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();
 
}
catch (Exception ex)
{
    Label3.Text = "Error while reading" + ex.ToString();
}
finally
{
    con.Close();
}





意思是如果我有一个时间下拉列表,如0830-1030,当我选择该时间并点击提交,我的程序将自动读取所有这3个csv文件并显示在gridview [fpyield 12162013 1030.csv],[fpyield 12162013 0930.csv],[fpyield 12162013 0830.csv] ......有可能吗?这意味着每当我从下拉列表中选择时它会自动读取这3个文件...所以我不需要编写代码来打开这个我只需要调用下拉列表时间段

谢谢你很多....



Meaning if i got a dropdownlist with time in it like 0830-1030, when i selected that timing and click submit , my program will read all this 3 csv files automatically and show in gridview [fpyield 12162013 1030.csv],[fpyield 12162013 0930.csv],[fpyield 12162013 0830.csv] ... is it possible? meaning it will go and read this 3 file automatically whenever i select from dropdownlist...so that i don need to write code to open this i just need to call the dropdown list time period
Thank you so much....

推荐答案

你必须使用 DropDownList SelectedIndexChanged [ ^ ]活动。



在活动内部,阅读文件并填写 GridView 中的内容。
You have to use DropDownList SelectedIndexChanged[^] Event.

Inside the Event, read the files and populate contents in GridView.


这篇关于基于Web的数据管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆