c#中创建表

it2022-11-28  25

 

Code  1  DataTable table = new DataTable(); 2            table.Columns.Add("ID"typeof(string)); 3            table.Columns.Add("Name"typeof(string)); 4 5            DataRow row = table.NewRow(); 6 7            row["ID"= "All"; 8            row["Name"= "全部"; 9            table.Rows.Add(row);10            row = table.NewRow();11            row["ID"= "Add";12            row["Name"= "添加";13            table.Rows.Add(row);14            row = table.NewRow();15            row["ID"= "Update";16            row["Name"= "修改";17            table.Rows.Add(row);18            row = table.NewRow();19            row["ID"= "Delete";20            row["Name"= "删除";21            table.Rows.Add(row);

 

 

Code //Dictionary 的用法  Dictionary<stringint> dic = new Dictionary<stringint>();         private int  GetLevel(string id)         {             int num = 0;             foreach(KeyValuePair<stringint> d in dic)             {                                if (d.Key.ToString() == id) {                     num =Convert.ToInt32(d.Value);                 }                 }             return num;         }

转载于:https://www.cnblogs.com/yingpp/archive/2008/12/22/1359775.html

最新回复(0)