C#C
C#2y ago
1 reply
yambo

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.
image.png
Was this page helpful?