private void qButton1_Click(object sender, EventArgs e) { String strConn = "server= .\\SQLEXPRESS;uid=sa;pwd=sasa;database=jxcbook"; SqlConnection conn = new SqlConnection(strConn); String sqlId = "select * from [业务员清单] "; conn.Open(); SqlCommand cmd = new SqlCommand(sqlId, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "业务员清单"); dataGridView1.DataSource = ds; dataGridView1.DataMember = "业务员清单"; conn.Close(); }