retrive data from data drid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roheetbakshi
    New Member
    • Feb 2008
    • 3

    retrive data from data drid

    hi
    iam using windows application to develop a S/W where i have entered the data through text box into the datgrid

    now i want to retrive the data from the datagrid & show back into the text box on the form from where i have entered the data
    i am unable to write the code plz helpme in finding the code or plz send in the code to make unerstand how to use the datagrid more advancelly
  • indianmaestro
    New Member
    • Mar 2008
    • 16

    #2
    the question is not clear any way i am sending some code here it may help you

    this is to retrive the data from the data base and show the data in the controls on the page like textbox etc...

    string qur="select * from table1";
    Sqlcommand cmd=new sqlcommand(qur, con);
    sqldatareader dr=cmd.ececuter eader();

    while(dr.read() )
    {

    textbox1.text=d r(0).tostring() ;
    textbox2.text=d r(1).tostring() ;
    textbox3.text=d r(2).tostring() ;
    }

    Comment

    • nev
      Contributor
      • Oct 2007
      • 251

      #3
      Originally posted by roheetbakshi
      hi
      iam using windows application to develop a S/W where i have entered the data through text box into the datgrid

      now i want to retrive the data from the datagrid & show back into the text box on the form from where i have entered the data
      i am unable to write the code plz helpme in finding the code or plz send in the code to make unerstand how to use the datagrid more advancelly
      If you're using DataTable, you can get the data like this:

      Textbox1.Text = DataTable.Defau ltView("Record No")("Column Name")

      Comment

      Working...