Académique Documents
Professionnel Documents
Culture Documents
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace signupapp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//MessageBox.Show(reader["UserId"].ToString());
// MessageBox.Show(reader[2].ToString());
//part3
dataGridView1.Rows.Add(reader[0].ToString(), reader[1].ToString(),
reader[2].ToString(), reader[3].ToString(), reader[4].ToString());
}
reader.Close();
cn.Close();
}
//
// Button ajouter un user
//
private void btnAjouter_Click(object sender, EventArgs e)
{
//-1 ouvrir la connexion avec la base de donnees
string source = "Data source =LAPTOP-O31U25L6\\SQLEXPRESS;Initial
Catalog=tp1;Integrated Security=True;";
SqlConnection cn = new SqlConnection(source);
cn.Open();
{
//on affiche un message
MessageBox.Show(nbrupdate + "element(s) a ete bien modifie");
}
textBox1.Text = string.Empty;
textBox2.Text = string.Empty;
textBox3.Text = string.Empty;
textBox4.Text = string.Empty;
textBox5.Text = string.Empty;
}
}
reader.Close();
cn.Close();
}
}
}