这个asp.net代码没有提取任何数据为什么?

时间:2014-11-17 06:12:02

标签: asp.net

 DataTable table = new DataTable();  
  DataSet ds = SqlHelper.ExecuteDataset(Utility.GetPumaConString(), 
  CommandType.Text, @"SELECT name,IsBlocked FROM 
  ht_cust where type=14 and DealerId<>19");
  return ds.Tables[0];      

1 个答案:

答案 0 :(得分:0)

请在您的项目中尝试此操作。

SqlConnection connection = new SqlConnection("your connectiongstring");
SqlCommand cmd = new SqlCommand("SELECT name,IsBlocked FROM ht_cust where type=14 and DealerId<>19", connection);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
connection.Open();
da.Fill(dt);

//bind it to the grid
gv.DataSource = dt;
gv.DataBind();

connection.Close();