Opening DB Connection: Object cannot be cast from DBNull to other types
Help. Im trying to open a connection to my mariaDB database. i can access the database with the credentials perfectly fine from dbeaver, but executing this code gives me trouble:
Simply trying to open a connection inside the DBConnection class which handles Open Close Dispose and the connection string ($"Server={config.Server};Database={config.Database};Uid={config.User};Pwd={config.Password};";), gives me this exception:
System.InvalidCastException: 'Object cannot be cast from DBNull to other types.'
Why would this show up directly at opening up a connection? I can even see that the connection state went from closed to open, but then the exception happens.
1 Reply
i should mention that my database so far has only one table with no data in it, but this shouldnt prevent me from being able to open it??