SQL Server Database stuck in Restoring state

Posted by WorldofCode on Jul 22nd, 2010
2010
Jul 22

From time to time your sql database will get stuck in Restoring state.  Here are two different ways to get your database out of restoring state. 

RESTORE DATABASE MyDatabase 
   FROM DISK
= ‘MyDatabase.bak’ 
   WITH REPLACE
,RECOVERY

or
  1. Stop the service (MSSQLSERVER);
  2. Rename or delete the Database and Log files (C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data…) or wherever you have the files;
  3. Start the service (MSSQLSERVER);
  4. Delete the database with problem;
  5. Restore the database again.

 

Convert VB to C# or C# to VB

Posted by WorldofCode on Jul 21st, 2010
2010
Jul 21

Handy tool for conveting code inbetween VB and C# or vice versa.

http://converter.telerik.com/

 

Get MP3 file duration/length

Posted by WorldofCode on Jul 20th, 2010
2010
Jul 20

C# code for if you are trying to get the mp3 length or duration of a media file.  You will need to reference Windows Media Player.  Go to Com Add-ins to add the wmp.dll to your project. 

string Duration = null;
WMPLib.WindowsMediaPlayer w = new WMPLib.WindowsMediaPlayer();
WMPLib.IWMPMedia m = w.newMedia(Filename);
if (m != null) {
 Duration = m.durationString;
}
w.close();