Slt, je suis débutant en programmation en c#
je veut réaliser une connexion entre c# et une base de donnée Mysql, j'utilise PhpMyAdmin pour gérer ma base mysql. et dans mon programme je met le code suivant :
le code retourne toujours false
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 class admin() { private SqlConnection Connection = new SqlConnection(); string ConnnectionStr; admin(){ConnnectionStr = String.Empty;} boolean connect() { ConnnectionStr = "Database=amine; Data Source=172.0.0.1; User Id=root; Password=" + ConnnectionStr; Connection.ConnectionString = ConnnectionStr; try { Connection.Open(); Connection.Close(); return true; }catch (SqlException Ex){return false;} } }et je comprned pas pourquoi
Merci pour vos aides . . .
Partager