updating a row in datagrid..
- From: "rcoco" <nclauder@xxxxxxxx>
- Date: 10 Jan 2007 23:18:52 -0800
Hi everyone,
I'm having with selecting a row in a datagrid. I have a datagrid that
is ment to update and it runs very well, But I don't want the user to
keep scrolling when ever they want to update so I created a
textbox(txtname) and a button where a user is supposed to write a name
and by the click of the button the corresponding row is selected. Now
where the problem is it's that when I write a name say
Ndayahundwa,Claude and press button I get this error:
Incorrect syntax near 'Ndayahundwa'. Here is the code I'm using:
SqlCommand myCommand = new SqlCommand();
myCommand.Connection=con;
myCommand.CommandText="select * from isp_email.staff where @fullname
like%" +txtname.Text+ "%";
SqlParameter myparam = new SqlParameter("@fullname",SqlDbType.Text);
myparam.Value=txtname.Text;
myCommand.Parameters.Add(myparam);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
dgupdate.DataSource=ds;
dgupdate.DataBind();
Could some one bail me out?
Thanks.
.
- Follow-Ups:
- Re: updating a row in datagrid..
- From: WhoKnows
- Re: updating a row in datagrid..
- From: WhoKnows
- Re: updating a row in datagrid..
- From: WhoKnows
- Re: updating a row in datagrid..
- Prev by Date: Datagrid Data loaded twice
- Next by Date: Command Button to Open Window
- Previous by thread: Datagrid Data loaded twice
- Next by thread: Re: updating a row in datagrid..
- Index(es):
Loading