selecting one row from datagrid

  • Thread starter Thread starter rcoco
  • Start date Start date
R

rcoco

I want to select one Row from a datagrid so I create a
textBbox(txtname) and Button for the user to write the name in textBox
and By the click of the button it select the corresponding row. But
it's not selecting the row neighther I'm getting any mistake message
I'm I missng some thing? I wrote the code on Button_Click sqlCommand as
follows:
SqlCommand myCommand = new SqlCommand("SELECT * from employee where
fullname Like %+txtname+%" ,con);
Thank you.
 
Hi rcoco,

if you want to select a row in the grid, there is no use to make request
against the database.
you should loop through the grid rows and set the row with the given ID to
selected.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top