DataTable添加数据

    技术2022-06-12  69

    DataTable dt=new DataTable("cart"); DataColumn dc1=new DataColumn("prizename",Type.GetType("System.String")); DataColumn dc2=new DataColumn("point",Type.GetType("System.Int16")); DataColumn dc3=new DataColumn("number",Type.GetType("System.Int16")); DataColumn dc4=new DataColumn("totalpoint",Type.GetType("System.Int64")); DataColumn dc5=new DataColumn("prizeid",Type.GetType("System.String")); dt.Columns.Add(dc1); dt.Columns.Add(dc2); dt.Columns.Add(dc3); dt.Columns.Add(dc4); dt.Columns.Add(dc5); for(int i=0;i<10;i++) { DataRow dr=dt.NewRow(); dr["prizename"]="娃娃"; dr["point"]=10; dr["number"]=1; dr["totalpoint"]=10; dr["prizeid"]="001"; dt.Rows.Add(dr); }


    最新回复(0)