OdbcDatReader problems
I'm trying to connect my application with a mysql database, the problem is when the column in the database is of type Varchar or of any type of text, it throws an exception to me ArgumentOutOfRangeException. To make this latter one clearer, this is the structure of the table and the code used:
TABLE: Usuario
Columns: ID NICK PASSWORD
1st Row: 1 Admin 12345
OdbcConnection con = MiConexion.ObtenerConexion();
OdbcCommand comando = new OdbcCommand("SELECT * FROM usuario WHERE ID = 1 LIMIT 1",con);
OdbcDataReader lector = comando.ExecuteReader();
if(lector.Read())
{
for (int i = 0; i < lector.FieldCount; i++)
Debug.Log(lector[i].ToString());
}
lector.Close();
comando.Dispose();
con.Close();
con.Dispose();
if I try to get the Nick Field value, the application throws ArgumentOutOfRangeException, but if I change the Nick Field's collation in the table structure, the exception never is throwed but there isn't any information in the variable.
NOTE: if i use this code in a windows forms application the code works perfectly, Driver={MySQL ODBC 5.3 Unicode Driver
Your answer
Follow this Question
Related Questions
Why is MySQL search query not returning each row in 1 index of an array? 0 Answers
Get value from array in unity: debug works, value's changing, but color not changing 0 Answers
How to Synchronise between Server Database (MYSQL) and Local database (SQLite) 1 Answer
Delete data in mysql 0 Answers
Unity sql PHP script can log in with wrong password, what's wrong? 0 Answers