Up-Date record in SQL Database using C#.net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=localhost\SQLExpress;Initial Catalog=awais;Integrated Security=True;Integrated Security=True ");
cnn.Open();
string query = "update logout set name ='"+TextBox3.Text+"' where name = '" + TextBox2.Text + "';";
SqlCommand cmd = new SqlCommand(query, cnn);
cmd.ExecuteNonQuery();
Response.Write("update is done!");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Data;
using System.Data.SqlClient;
namespace WebApplication1
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
{
SqlConnection cnn = new SqlConnection(@"Data Source=localhost\SQLExpress;Initial Catalog=awais;Integrated Security=True;Integrated Security=True ");
cnn.Open();
string query = "update logout set name ='"+TextBox3.Text+"' where name = '" + TextBox2.Text + "';";
SqlCommand cmd = new SqlCommand(query, cnn);
cmd.ExecuteNonQuery();
Response.Write("update is done!");
}
}
}
Post a Comment