When we have the problem with READ ONLY SQL DATABASE(It can happen while we trying to attach different version database file), first up all we need to make the security of ldf and mdf file to everyone-Full Control.( if not working, do the same for folder and drive in which the database file resides. )
And then simply execute the script
USE [master]
Go
Alter database [readonlydb] set READ_WRITE WITH NO_WAIT
GO
Or use the query without the NO_WAIT option.
USE [master]
Go
Alter database [readonlydb] set READ_WRITE
GO