单项选择题
dt为DataTable类型的变量,引用名为"Customers"的DataTable对象。该表中包含"CustomerID"、"CustomerName"、"Address"、"Telephone"等4列。将数据列"CustomerID"设为该表的主键的正确语句有:()
A.dt.PrimaryKey="CustomerID";
B.dt.PrimaryKey.Add("CustomerID");
C.dt.PrimaryKey=new object[]{"CustomerID"};
D.dt.PrimaryKey=new DataColumn[]{dt.Columns["CustomerID"]};
点击查看答案
相关考题
-
单项选择题
已知ds1、ds2分别代表两个不同的DataSet对象。其中ds1已包含名为“Customer”的DataTable对象,且该DataTable对象被变量dt_Customer引用。已知dt_Customer表中有100条记录,则执行下列语句后,新的数据表new_dt_Customer中包含()条记录。DataTable new_dt_Customer=dt_Customer.Copy();
A.0
B.100
C.200
D.300 -
多项选择题
下列哪些方法可以在DataSet对象ds中添加一个名为“Customers”的DataTable对象?()
A.DataTable dt_customers=new DataTable();
B.DataTable dt_customers=new DataTable("Customers");
C.ds.Tables.Add("Customers");
D.ds.Tables.Add(newDataTable("Customers"); -
单项选择题
为了在程序中使用DataSet类定义数据集对象,应在文件开始处添加对命名空间()的引用。
A.System.IO
B.System.Utils
C.System.Data
D.System.DataBase
