2
Answers

asp.net

ashima kukreja

ashima kukreja

11y
1.7k
1
hello,

       i have a field in my table isadmin where if he is admin it is 1 otherwise it is set to 0.
on a page load i want to show my gridview  so i am wiritting   this code .


SqlCommand cmd = new SqlCommand(" select fname,lname from UserInfo where IsAdmin=@IsAdmin" , cn);
                    cmd.Parameters.Add(new SqlParameter("@IsAdmin" i want here  that isadmin should take 0 so that it will display rows what to write here ));

                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    GridView1.DataSource = ds;
                    GridView1.DataBind();

Answers (2)