Bonjours,
Je suis en train d'essayer de mettre en relation deux formulaire appelé feuille1 et feuille2.
Dans la feuille1 je doit saisir un chiffre et cela doit remplir ma fuille2.
Mias hélas impossible à réaliser donc si quelqu'un a une idée qu'il me dise.
Information suplémentaire je suis en mode connecté.
Afin de vous aider voici le scripte de la feuille2 :
merci pour tous !!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace Papyrus2 { public partial class Feuille2 : Form { //Objet ADO.net private SqlConnection sqlConnect; private SqlCommand sqlCom; private SqlDataReader sqlDR; public Feuille2() { InitializeComponent(); //Création de la connection sqlConnect = new SqlConnection(); sqlConnect.ConnectionString = "Data Source=PC-DE-UTILISATE\\SQLEXPRESS; Initial Catalog=Papyrus; Integrated Security=True"; try { //Ouvre la connection sqlConnect.Open(); //Création de la commande sqlCom = new SqlCommand(); sqlCom.Connection = sqlConnect; //Requète SQL string strSql = "Select * from stgXX.FOURNIS"; //Propriété de la requète sqlCom.CommandType = CommandType.Text; sqlCom.CommandText = strSql; //Exécution de la commande sqlDR = sqlCom.ExecuteReader(); //Lecture des données du Datareader int i = 0; while (sqlDR.Read()) { int NUMFOU = sqlDR.GetInt32(0); char NOMFOU = sqlDR.GetChar(1); txtNom.Text = Convert.ToString(NOMFOU); char RUEFOU = sqlDR.GetChar(2); txtAdresse.Text = Convert.ToString(RUEFOU); char POSFOU = sqlDR.GetChar(3); txtCP.Text = Convert.ToString(POSFOU); char VILFOU = sqlDR.GetChar(4); txtVille.Text = Convert.ToString(VILFOU); char CONFOU = sqlDR.GetChar(5); txtContact.Text = Convert.ToString(CONFOU); int SATISF = sqlDR.GetInt16(6); txtSatisfaction.Text = Convert.ToString(SATISF); } //Fin de données sqlDR.Close(); } catch (SqlException ex) { //Traitement des exceptions } finally { sqlConnect.Close(); } } private void btnRetour_Click(object sender, EventArgs e) { this.Close(); } } }
Partager