select client
unknown
abap
4 years ago
2.6 kB
7
Indexable
using System;
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 GestionDeSctock1.Forms
{
public partial class choseclient : MetroFramework.Forms.MetroForm
{
public choseclient()
{
InitializeComponent();
}
SqlConnection cn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=gestion2;Integrated Security=True;");
SqlDataAdapter da;
DataTable dt = new DataTable();
private void choseclient_Load(object sender, EventArgs e)
{
dt.Clear();
da = new SqlDataAdapter(@"SELECT [id]
,[Nom_client] as [Nom du client]
,[Address]
,[N_telephone] as [N° Téléphone]
,[N_registre_commerce] as [N° Registre commerce]
,[N_article] as [N° Article]
FROM [dbo].[client]", cn);
da.Fill(dt);
this.metroGrid1.DataSource = dt;
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
dt.Clear();
da = new SqlDataAdapter(@"SELECT [id]
,[Nom_client] as [Nom du client]
,[Address]
,[N_telephone] as [N° Téléphone]
,[N_registre_commerce] as [N° Registre commerce]
,[N_article] as [N° Article]
FROM [dbo].[client] WHERE [Nom_client] + [Address] + [N_telephone] + [N_registre_commerce] LIKE '%" + textBox1.Text + "%' ", cn);
da.Fill(dt);
this.metroGrid1.DataSource = dt;
}
private void metroGrid1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
textBox2.Text = metroGrid1.CurrentRow.Cells[1].Value.ToString();
}
private void addbtn_Click(object sender, EventArgs e)
{
Forms.addvente ad = new addvente(textBox2.Text);
this.Close();
}
}
}
Editor is loading...