Sei sulla pagina 1di 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

namespace SOFTEC
{
public partial class Gestion_des_produits : System.Web.UI.Page
{
SqlConnection Con = new SqlConnection(@"Data Source=hohi\sqlexpress;Initial
Catalog=softec;Integrated Security=True");
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["idArtisan"] == null)
{ Response.Redirect("Authentification.aspx"); }
Label7.Text = Session["idArtisan"].ToString();
}
private void clear()
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)
{
string req = string.Format("insert into Produit values ({0},
{1},'{2}','{3}',{4},{5})", TextBox1.Text, TextBox2.Text, TextBox3.Text,
TextBox4.Text,TextBox5.Text,Label7.Text );
SqlCommand cmd = new SqlCommand(req, Con);
Con.Open();
cmd.ExecuteNonQuery();
Con.Close();
clear();

}
}
}

Potrebbero piacerti anche