Je suis actuellement en cours de réalisation d'un jeu et j'ai un petit problème voila le code en question :
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, SharkEmu.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 :
MySqlDataReader Result = SQLCommand.ExecuteReader();
...
MySqlConnection con =new MySqlConnection("chemin de ta base de donnée");
...
con.Open();
MySqlDataReader Result = SQLCommand.ExecuteReader();
while (Result.Read())
{
...
}
Ce qui compte,ce n'est pas ce qu'on a mais plutôt ce que l'on fait avec ce qu'on a...