[MySQL ODBC][C#] Weird Exception
Okay, a while ago i coded a class for mysql in and i recently formatted and so im trying to get this class to work again. i installed the MySQL ODBC Drivers etc that i installed last time (Basically i followed this tut last time Geekpedia • Programming tutorial: Connecting to MySQL with C# and ODBC)
Did all of that stuff, the Data Sources (ODBC) thing in control panel connects fine to my local MySQL server, alls fine and well!
Until i try and use my class and when it tries to connect it throws an exception, unfortunately for some strange reason the Exception has no message! Its literally blank! :( The Exception.Message is just null And i have no idea what the Problem could be.
I've tried reinstalling etc (In case it was an installation error) but it just gives the same error every time.
Code:
" at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
at System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.Odbc.OdbcConnection.Open()
at Warlord.MySQL_Manager.Connect() in C:\\Coding Stuff\\ProjectX\\ProjectX\\Managers.cs:line 929
Thats the stack trace ^ If anybody could find that useful (Doubt it)
I've tried google and can't seem to find any answers for it so MAYBE some of the more intelligent users on this forum have come across this problem when using mysql? Hopefully?! :p
(I know its a long post to read, but i thought i'd try and explain it all)
Any help would be most welcome, it literally has stumped me, i've got no idea whats gone wrong.
~ Jeax
Re: [MySQL ODBC][C#] Weird Exception
you might wanna paste the line that throws the exception. might shed some light upon this, but yeah i agree, that is one really stupid exception....and you said it use to work, and suddenly it doesnt even though nothing was changed?
Re: [MySQL ODBC][C#] Weird Exception
Well nothing that i can think of has changed, i've installed a fresh copy of windows Professional.
Code:
private System.Data.Odbc.OdbcConnection OdbcCon;
private System.Data.Odbc.OdbcCommand OdbcCom;
private System.Data.Odbc.OdbcDataReader OdbcDR;
public void Connect()
{
ConStr = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=" + MySQL_IP + ";PORT=" + MySQL_Port + ";DATABASE=" + MySQL_DB + ";UID=" + MySQL_Username + ";PWD=" + MySQL_Password + ";OPTION=3";
OdbcCon = new System.Data.Odbc.OdbcConnection(ConStr);
try
{
if (OdbcCon.State == ConnectionState.Closed)
{
OdbcCon.Open();
}
Main._Debug("Connected to MySQL");
}
catch (System.Data.Odbc.OdbcException Ex)
{
Main._Debug("MySQL Error - " + Ex.StackTrace);
}
}
The Line it throws the exception on is OdbcCon.Open()
But as i said before, it can't be the code as it USED to work so i'm kind of stumped with it.
Re: [MySQL ODBC][C#] Weird Exception
suppose the try isnt executed correctly, and the catch part is used instead? hm... looks really weird, havent worked with odbc at all actually, atm i use LINQ <3
Re: [MySQL ODBC][C#] Weird Exception
its not the code (As this code used to work, and i've tested other 'Sample' code and they all give out this blank exception)
I'm wondering if its maybe a bug with the MySQL ODBC Connector, or any ideas on how i could possibly fix it all all. Its kinda a big problem for me, as i like to be able to integrate MySQL into my C# servers
~ Jeax