你也可以这样写:
void bind()
{
SqlConnection conn=new SqlConnection("server=(local);uid=sa;pwd=0;database=新思维");
conn.Open();
string sql="select top 10 * from kcb order by posttime desc";
SqlDataAdapter sdr=new SqlDataAdapter(sql,conn);
DataSet ds=new DataSet();
sdr.Fill(ds,"kcb");
DataGrid1.DataSource=ds.Table["kcb"];
DataGrid1.DataBind();
conn.Close();
}