zwei1121

博客园 首页 新随笔 联系 订阅 管理

  public DataTable GetData()     {         DataTable table = new DataTable();         table.Columns.Add("ID");         table.Columns.Add("FirstName");         table.Columns.Add("LastName");

        DataRow row;         row = table.NewRow();         row["ID"] = 1;         row["FirstName"] = "John";         row["LastName"] = "Smith";         table.Rows.Add(row);

        row = table.NewRow();         row["ID"] = 2;         row["FirstName"] = "John2";         row["LastName"] = "Smith2";         table.Rows.Add(row);

        return table;     }

 

 

 

DataTable dt = new DataTable();             dt.Columns.Add("ID", typeof(System.String));             dt.Columns.Add("Text", typeof(System.String));

            DataRow dr = dt.NewRow();             dr["ID"] = "1";             dr["Text"] = "5000元以下";             dt.Rows.Add(dr);

            dr = dt.NewRow();             dr["ID"] = "2";             dr["Text"] = "10000元—19999元";             dt.Rows.Add(dr);

            dr = dt.NewRow();             dr["ID"] = "3";             dr["Text"] = "20000元—49999元";             dt.Rows.Add(dr);

            dr = dt.NewRow();             dr["ID"] = "4";             dr["Text"] = "50000元—99999元";             dt.Rows.Add(dr);

            dr = dt.NewRow();             dr["ID"] = "5";             dr["Text"] = "10万元以上";             dt.Rows.Add(dr);

posted on 2012-05-10 10:16  zwei  阅读(930)  评论(0编辑  收藏  举报