update command not working in gridview
<p>my code for update command:</p>

<pre><code>public void update(name,email,phone)
{
    using {sqlconnection con=new sqlconnection("some connection source"))
    {
        con.open();
        string str = "UPDATE register SET name = @name,email = @email WHERE phone = "@phone";

        using(sqlcommand cmd=new sqlcommand(str,con))
        {
            cmd.commandtype=commandtype.text;
            cmd.parameters.addwithvalue("@name",name);
            cmd.parameters.addwithvalue("@email",email);
            cmd.parameters.addwithvalue("@phone",phone);
            cmd.executenonquery();
        }
    }
}
</code></pre>

<p>and my row updating event is this:</p>

<pre><code>string name = ((TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0]).Text;
string email = ((TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0]).Text;
int phone = Convert.ToInt32(GridView1.Rows[e.RowIndex].Cells[3].Text);

update(name, email, phone);
GridView1.EditIndex = -1;
bindgridview();
</code></pre>

<p>In my table phone is the primary key, when I press update button its not firing no change nothing. Can anyone see my code and tell me where I did wrong</p>
