Few days ago, I was looking a issue faced by my colleague. He was trying to retrieve some values from Mysql db, using stored procedure. The application was layer down in different projects i.e. Data Access project for database communication and so on.
When he passed collection of parameter to data access, there was a weird error popsup i.e. (cannot cast MySql.Data.MysqlParameter to MySql.Data.MysqlParameter). I was amazed to see, whats going on. I double checked that the reference was added there.
After spending some time closely, I saw a dll hell type thing i.e. the Website had Mysql dll in the bin folder as well as in GAC and the data access referred it from GAC. As a result: the dll of different versions creating problem in type casting mysqlparameter collection from one project to another. I removed the dll from bin folder so that same GAC dll would be used in both projects and it started working.
Always add the project references cleanly to avoid this type of thing. I hope this post would be useful for you guys.
Happy Coding.....
No comments:
Post a Comment