Bonjour j'ai mon code qui est parfaite
je veux lorsque je clique sur le bouton les donner de la datatable doit être écrite dans un fichier txt aidez moi d'intégrer la fonction StreamWriter
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 private void button1_Click(object sender, EventArgs e) { string strAccessConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\rezgui mohamed\\Desktop\\agent\\rezgui.mdb"; OleDbConnection aConnection = new OleDbConnection(strAccessConn); DataTable table = new DataTable("results"); // OleDbCommand aCommand = new OleDbCommand("select * from test", aConnection); string sql = "select * from test"; aConnection.Open(); OleDbCommand cmd = new OleDbCommand(sql, aConnection); OleDbDataAdapter adpt = new OleDbDataAdapter(cmd); adpt.Fill(table); this.dataGridView1.DataSource = table; aConnection.Close(); }
merci d'avance
Partager