vs2017調(diào)試是灰色的 在逐語句調(diào)試的時(shí)候怎么看DataSet/DataTable里面的數(shù)據(jù)?
在逐語句調(diào)試的時(shí)候怎么看DataSet/DataTable里面的數(shù)據(jù)?1. 使用select方法查找沒有主鍵的表,或使用非主鍵字段查找。Datatable本身有一個(gè)select方法,它返回一個(gè)data
在逐語句調(diào)試的時(shí)候怎么看DataSet/DataTable里面的數(shù)據(jù)?
1. 使用select方法查找沒有主鍵的表,或使用非主鍵字段查找。Datatable本身有一個(gè)select方法,它返回一個(gè)datarows數(shù)組:using(SqlConnection firstconnection=new SqlConnection(connection string)){SqlCommand cmdemployee=firstconnection.CreateCommand命令() cmdEmployee.CommandText命令=“從雇員中選擇*”SqlDataAdapter sda=new SqlDataAdapter(cmdEmployee)數(shù)據(jù)集ds=new DataSet()sda.填充(ds,“Employees”)數(shù)據(jù)行[]dr=ds.表格[“雇員”]。選擇(“title like“production”)2。使用find方法查找具有主鍵的表可分為兩種情況:(1)主鍵只有一個(gè)字段,DataRow Dr=dt.Rows.Find行(“value of primary key field”)(2)一個(gè)主鍵有多個(gè)字段。例如,在AdventureWorks中sales.salersonquotahistory公司表的主鍵由int類型字段和datetime組成。以下代碼用于查找滿足“isalesperson d=268 and quotadate=2001-7-1 0:00:00”的記錄。Object[]obj=新對象[]{268,“2001-7-1 0:00:00”}dr=dt.Rows.Find行(目標(biāo))