C#中DataGrid加载XML数据
来源:互联网 发布:pv uv 数据库 设计 编辑:程序博客网 时间:2024/05/18 02:05
protected System.Web.UI.WebControls.DataGrid dgAddInfo;
public string xmlFileName = "Zph.xml";
private void Page_Load(object sender, System.EventArgs e)
{
// DataGridDataBind();
if(!IsPostBack)
{
DataLoad("ID") ;
}
}
#region
private void DataLoad( string SortString )
{
//string xmlFileName = @"c:/inetpub/wwwroot/zhaopinhui/Zph.xml " ;
DataSet ds = new DataSet();
FileStream FS = new FileStream( Server.MapPath(xmlFileName) ,FileMode.Open);
ds.ReadXml(FS);
if(ds.Tables.Count == 0)
{
ds.Tables.Add ( MakeZphTable() );
}
Trace.Warn("rowcount1=",Convert.ToString(ds.Tables[0].Rows.Count));
DataView dv =new DataView(ds.Tables[0]);
if(SortString.Length>0)
{
dv.Sort = SortString;
}
this.dgAddInfo.DataSource = dv;
this.dgAddInfo.DataBind();
FS.Close();
}
#endregion
#region 创建招聘会的表
private DataTable MakeZphTable()
{
DataTable theTable = new DataTable("Zph");
DataColumn theColumn1 = new DataColumn();
theColumn1.DataType = System.Type.GetType("System.Int32");
theColumn1.ColumnName = "ID";
theTable.Columns.Add(theColumn1);
DataColumn theColumn2 = new DataColumn();
theColumn2.DataType = System.Type.GetType("System.Int32");
theColumn2.ColumnName = "ZphID" ;
theTable.Columns.Add(theColumn2);
DataColumn theColumn3 = new DataColumn();
theColumn3.DataType = System.Type.GetType("System.String");
theColumn3.ColumnName = "Title";
theTable.Columns.Add(theColumn3);
DataColumn theColumn4 = new DataColumn();
theColumn4.DataType = System.Type.GetType("System.String");
theColumn4.ColumnName = "Content";
theTable.Columns.Add(theColumn4);
DataColumn theColumn5 = new DataColumn();
theColumn5.DataType = System.Type.GetType("System.DateTime");
theColumn5.ColumnName = "Date";
theTable.Columns.Add(theColumn5);
DataColumn theColumn6 = new DataColumn();
theColumn6.DataType = System.Type.GetType("System.String");
theColumn6.ColumnName = "Time";
theTable.Columns.Add(theColumn6);
DataColumn theColumn7 = new DataColumn();
theColumn7.DataType = System.Type.GetType("System.String");
theColumn7.ColumnName = "Num";
theTable.Columns.Add(theColumn7);
DataColumn theColumn8 = new DataColumn();
theColumn8.DataType = System.Type.GetType("System.String");
theColumn8.ColumnName = "Place";
theTable.Columns.Add(theColumn8);
return theTable;
}
- C#中DataGrid加载XML数据
- C#中DataGrid加载XML数据--删除数据
- C#中DataGrid加载XML数据--添加数据
- C#中DataGrid加载XML数据---上移和下移
- C#中DataGrid加载XML数据--在另外一页面修改数据
- C#中DataGrid加载XML数据--管理 传值到例外个页面 再传值
- Flex DataGrid从XML文件中加载数据
- C# datagrid加载不了数据
- C#加载xml配置文件,将数据存放在Dictionary中
- easyui datagrid 中数据加载的问题
- 将XML数据读入DataGrid中
- 前台加载datagrid 数据
- Flex中在DataGrid加载数据时显示Loading...
- easyui datagrid当表格中没有数据加载失败
- easyui datagrid 数据加载到另一datagrid
- c#中DataGrid的数据新增编辑删除操作代码
- C#中DataGrid 重新绑定数据的代码
- wince 在C#中 对datagrid 的数据添加
- 揭开神秘面纱 诺基亚9款新机揭密
- DOM知识的翻译与整理
- IOC 设计(学习篇)
- TPTP官方文档
- 学习Xen不得不读的一篇文章
- C#中DataGrid加载XML数据
- Win2003系统安装SQL Sever2000后1433端口未开放的解释
- C#中DataGrid加载XML数据--删除数据
- 如何用代码设置图层在特定比例尺下显示
- 获取当前登录用户的window station个数和Desktop对象的个数
- ClassLoader Mechanism
- 7.4
- C#中DataGrid加载XML数据--在另外一页面修改数据
- 使用浮点数和小数中的技巧和陷阱