nagarou
Messages postés12Date d'inscriptiondimanche 15 novembre 2009StatutMembreDernière intervention 6 mai 2011
-
6 mai 2011 à 00:41
nagarou
Messages postés12Date d'inscriptiondimanche 15 novembre 2009StatutMembreDernière intervention 6 mai 2011
-
6 mai 2011 à 16:48
Bonsoir,
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();
NSUADI
Messages postés540Date d'inscriptionmardi 4 août 2009StatutMembreDernière intervention 1 février 20132 6 mai 2011 à 01:28
ou plutôt:
...
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...