Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
 
namespace WebProjectOISD.ITuser
{
    public partial class WebEditProfile1 : System.Web.UI.Page
    {
        SqlConnection con = new SqlConnection("data source=MANAS-PC\\SQLEXPRESS; initial catalog=Project ;integrated security=true;");
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void submit_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Session["id"].ToString());
            
            string query = "update ITTEAM set Name='" +TextBox1.Text+"',Username='" + TextBox2.Text+"',Mobile='" + TextBox3.Text+"',Email_Id='"+TextBox4.Text+"' where IT_Team_Id='" + id+ "'";
            SqlCommand cmd = new SqlCommand(query, con);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
        }
    }
}
Posted 27-Feb-13 3:21am
Edited 27-Feb-13 3:27am
2.6K
v2
Comments
Asim Mahmood at 27-Feb-13 9:29am
   
what is error and at which line error is?
BC @ CV at 27-Feb-13 9:29am
   
If you want an answer your going to need to supply more information...like perhaps what exactly the error message is.
ThePhantomUpvoter at 27-Feb-13 9:29am
   
It would really help to know what "the error" is. And you really should look into parameterized queries instead of the SQL injection attack mess you have going on.
joshrduncan2012 at 27-Feb-13 11:34am
   
I second the SQL injection prevention measures.
ThePhantomUpvoter at 27-Feb-13 9:32am
   
And id is an integer and you are treating as if is were a string in your query. Which a parameterized query would help with.
Hrushikesh_phapale at 27-Feb-13 10:34am
   
In which line you getting the error????

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 718
1 OriginalGriff 420
2 CPallini 385
3 George Jonsson 231
4 Richard Deeming 145
0 OriginalGriff 5,450
1 CPallini 4,500
2 Sergey Alexandrovich Kryukov 4,272
3 George Jonsson 3,057
4 Gihan Liyanage 2,445


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 27 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100