示例#1
0
        private void frm_grant_sa_Load(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(SqlLink.linkmethod());
            SqlCommand    cmd = new SqlCommand(SqlSelect.GrantLoadlocalusermethod(), con);

            cmd.Parameters.AddWithValue("@username", Account);
            con.Open();
            SqlDataAdapter adapt = new SqlDataAdapter(cmd);
            DataSet        ds    = new DataSet();

            adapt.Fill(ds);
            con.Close();
            dgv_grant_sa_localuser.DataSource = ds.Tables[0];

            SqlConnection con1 = new SqlConnection(SqlLink.linkmethod());
            SqlCommand    cmd1 = new SqlCommand(SqlSelect.GrantLoadAllusermethod(), con1);

            con1.Open();
            SqlDataAdapter adapt1 = new SqlDataAdapter(cmd1);
            DataSet        ds1    = new DataSet();

            adapt1.Fill(ds1);
            con.Close();
            dgv_grant_sa_alluser.DataSource = ds1.Tables[0];
        }