//引命名空间
using System .Data.SqlClient;
//连接OA
SqlConnection con=new SqlConnection ("server=localhost;uid=sa;pwd=123;database=OA");
SqlCommand cmd=new SqlCommand ("select * from t_employee",con);
SqlDataAdapter da=new SqlDataAdapter (cmd);
DataSet ds=new DataSet ();
//填充数据集
da.Fill(ds);
this.DataGrid1.DataSource=ds;
//绑定 数据
this.DataGrid1.DataBind();