SQL Server 2005/2008 Express edition has the limitation of 4 GB per database. As far as I known the database engine considers data only, thus excluding log files, unused space, and index size.
Getting the length of the MDF file should not give the correct database size in terms of SQL Server limitation. My question is how to get the database size?