Mysql C# Demande
Nagarou
-
meyegui -
meyegui -
Bonsoir,
Je suis actuellement en cours de réalisation d'un jeu et j'ai un petit problème voila le code en question :
Code C# :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using Microsoft.VisualBasic;
using System.Collections;
using System.Data;
using System.Diagnostics;
namespace Zaap
{
public class ZaapsManager
{
public static List<Zaap> ListOfZaaps = new List<Zaap>();
public static void LoadZaaps()
{
string SQLText = "SELECT * FROM zaaps_db";
MySqlCommand SQLCommand = new MySqlCommand(SQLText, Utils.Sql2.Others);
MySqlDataReader Result = SQLCommand.ExecuteReader();
while (Result.Read())
{
Zaap NewZaaps = new Zaap();
NewZaaps.MapID = Result.GetInt32("MapID");
NewZaaps.CellID = Result.GetInt32("CellID");
ListOfZaaps.Add(NewZaaps);
}
}
}
}
Le problème est Pas une erreur sur le code mais sur mon application quand je lance
L'erreur sur l'application est Initialisation échouer - Connection must be valid and open
Sur la ligne :
Code C# :
MySqlDataReader Result = SQLCommand.ExecuteReader();
Merci de me venir en aide
Je suis actuellement en cours de réalisation d'un jeu et j'ai un petit problème voila le code en question :
Code C# :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using Microsoft.VisualBasic;
using System.Collections;
using System.Data;
using System.Diagnostics;
namespace Zaap
{
public class ZaapsManager
{
public static List<Zaap> ListOfZaaps = new List<Zaap>();
public static void LoadZaaps()
{
string SQLText = "SELECT * FROM zaaps_db";
MySqlCommand SQLCommand = new MySqlCommand(SQLText, Utils.Sql2.Others);
MySqlDataReader Result = SQLCommand.ExecuteReader();
while (Result.Read())
{
Zaap NewZaaps = new Zaap();
NewZaaps.MapID = Result.GetInt32("MapID");
NewZaaps.CellID = Result.GetInt32("CellID");
ListOfZaaps.Add(NewZaaps);
}
}
}
}
Le problème est Pas une erreur sur le code mais sur mon application quand je lance
L'erreur sur l'application est Initialisation échouer - Connection must be valid and open
Sur la ligne :
Code C# :
MySqlDataReader Result = SQLCommand.ExecuteReader();
Merci de me venir en aide
A voir également:
- Mysql C# Demande
- Mysql community server - Télécharger - Bases de données
- Could not connect to mysql! please check your database settings! - Forum Redhat
- Phpmyadmin a tenté de se connecter au serveur mysql, et le serveur a rejeté la connexion. merci de vérifier les valeurs de host, username et password dans la configuration et de s'assurer qu'elles correspondent aux informations fournies par l'administrateur du serveur mysql. ✓ - Forum PHP
- Mysql error in file: /engine/classes/mysql.php at line 53 ✓ - Forum Réseaux sociaux
- Xampp mysql ne démarre pas ✓ - Forum MySQL