Sreekanth

Sreekanth

  • NA
  • 439
  • 997.2k

windows froms,combobox,datagridview

Oct 28 2009 11:54 PM
public void Cmbfill(DropDownList Cntrl,string Sql)
        {
            Cmd=new SqlCommand(Sql,con);
            Cmd.CommandTimeout=0;
            myReader=Cmd.ExecuteReader();
            Cntrl.Items.Clear();

             if (myReader.HasRows)
             {
                
                while (myReader.Read())
                {

      ListItem Lst2=new ListItem(myReader[1].ToString(),myReader[0].ToString());
                 
                  Cntrl.Items.Add(Lst2);
                }
                myReader.Close();


            }
            else
            {
                myReader.Close();
            }
    
        }

this our simple code in filling dropdownlist in web forms...

i nedd exact coding in C# for windows application. & and one more datagridview control details in fullstrngth

pls help me?

Answers (2)