Połączenie z MYSQL za pomoca sterów MySQLDriverCS

0

Znalazlem taki przykladzik na jakiejs stronce i wrzucilem to w przyklad:

try
{
  MySQLConnection con;
  con = new MySQLConnection( new MySQLConnectionString("localhost",
                                                        "database",
                                                        "user",
                                                        "pass").AsString );
  con.Open();

  string sql = "SELECT * FROM Table";

  MySQLCommand cmd = new MySQLCommand(sql,con);  
  
  MySQLDataReader reader = cmd.ExecuteReaderEx();

  while(reader.Read())
  {
    Console.WriteLine( reader[0].ToString() );
  }

  reader.Close();        
  con.Close();
}
catch(Exception ee)
{
  Console.WriteLine( ee.ToString() );
}

i przy zapytaniu select * from tabela wyskakuje mi blad:

System.FormatException: The DateTime represented by the string is not supported in calendar System.Globalization.GregorianCalendar.
at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)
at System.DateTime.ParseExact(String s, String format, IFormatProvider provider)
at MySQLDriverCS.MySQLDataReader..ctor(Void* result, MySQLConnection _connection, MySQLCommand _cmd, Boolean CloseConnection)
at MySQLDriverCS.MySQLCommand.ExecuteReader(Boolean CloseConnection)
at MySQLDriverCS.MySQLCommand.ExecuteReaderEx()

Natomiast jak wpisze select kolumna from tabela wynik jest ale kazdy wyglada tak: System.byte[], dobrze jest tylko wp rzypadku jak kolumna jest typu INT.
Musze przyznac ze artykul bardzo marny bo nic tam wiecej nie pisalo jaki moze byc problem?

0

Jeśli ktoś ma podobny problem to nalezy użyć MySQLConnectionString!!!!

1 użytkowników online, w tym zalogowanych: 0, gości: 1