Community
Showing results for 
Search instead for 
Do you mean 
Reply

'Unable to cast object of type 'System.DBNull' to type 'System.String'

Copper Contributor
Posts: 32
Country: USA

'Unable to cast object of type 'System.DBNull' to type 'System.String'

Running ACT v16 Premium.  Attempting to unpack and restore a database, but it wouldn't restore.  In ACTDIAG the database was initially listed as SUSPECT, but now says "RECOVERY-PENDING".  Trying to detach database, but every time I select the database and click "Actions" I get an error message that says "Unable to cast object of type 'System.DBNull' to type 'System.String'.  Have tried manually deleting the files but there was only the ALF file.  Also tried stopping ACT 7 instance of SQL.  Any suggestions would be greatly appreciated.

Administrator
Posts: 1,371
Country: United_Kingdom

Re: 'Unable to cast object of type 'System.DBNull' to type 'System.String'

[ Edited ]

I would recommend restoring from a recent backup if you have one.

If not, then you could try stopping the SQL instance - then physically moving the ADF and ALF files to another location and renaming them. Then restarting the instance and trying to attach them.

Sometimes methods like this will cause open transactions in the log file, which usually will require re-creation. I can provide steps on this if it becomes necessary.

Copper Contributor
Posts: 32
Country: USA

Re: 'Unable to cast object of type 'System.DBNull' to type 'System.String'

What do you mean by "restore from a recent backup"?  

 

I'm a little concerned that the only database file I can find is the ALF.  The ADF is no where in sight.

Administrator
Posts: 1,371
Country: United_Kingdom

Re: 'Unable to cast object of type 'System.DBNull' to type 'System.String'

Well the ADF is the actual database itself - without that all you have is a log file.

If you have any backups of the database that were taken recently, you can restore from them - that's why we recommend setting a regular scheduled database backup.

The error message you're getting in ActDiag is because the database is no longer in the location it's supposed to be.
Could it be that the file directories have been restructured, or a drive has been disconnected/renamed?

You could try using Windows search function for "*.adf" or the name of your database to see if you can find the file if you suspect it has been moved rather than deleted.

Unfortunately, if the ADF is gone, and you don't have a backup, or any way to restore the adf - then there's not much that can be done.