[C#] Connection base de données
bonjour, voila la situation :
- base de données Access => lien Odbc
- pas de user ni de mot de passe
Code:
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
|
/* les librairies déclaré */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using System.Data.Odbc;
/* déclaration des variables */
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private OdbcConnection connexion=null;
/* un bouton, qui dois faire la connection */
void Button1Click(object sender, System.EventArgs e)
{
try{
Console.Out.WriteLine("youhou");
connexion = new OdbcConnection ("Gestionnaire");
connexion.Open();
}
catch{
Console.Out.WriteLine("erreur d ouverture ");}
} |
Petit detail : Gestionnaire est le nom du lien Odbc
en faite je ne suis meme pas sur que l evenent du clic sur le bouton soit bon bien gere ...
pouvez vous m aidez ?