Unable to cast object of type 'System.DBNull' to type 'System.String'
Posted by: naren gokal
Date: March 11, 2012 03:29PM


I am using MVC3 ASP, and have configured my web.config file to login into the MYSQL DB as root. I have created many stored procedures which i can connect fine with. i now want to change this login user to a public user, called tempuser and NOT root anymore.

However, when i change the login user from "root" to "tempuser", i get the error:
Unable to cast object of type 'System.DBNull' to type 'System.String'

i get the above error at the execution of ExecuteNonQuery().

I have granted access to the functions by:
GRANT EXECUTE ON FUNCTION check_user_exists to tempuser@'%';

I have also granted 'select' and 'update' on this table that im accessing which the function uses. I can login to mysql command line as tempuser and call the function manually with no problems. But when i run ExecuteNonQuery() i get the above error. I am currently using Visual Web Developer 2010, Razor Engine, MVC3.

ANy help, please.

I have been trying for weeks now with no luck.


Options: ReplyQuote

Written By
Unable to cast object of type 'System.DBNull' to type 'System.String'
March 11, 2012 03:29PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.