September 24, 2012

CREATE DATABASE failed


Error:
Message:  CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\XYZ.mdf".
Line Number: 2
Source: .Net SqlClient Data Provider
Procedure: 

Error:
Message: CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Line Number: 2
Source: .Net SqlClient Data Provider
Procedure:

Solution:
- Start application with Run as Administrator 
- Change the SQL Server service

September 09, 2012

Stop Compiler Warning Message

Problem:
- How can i stop warning ?
- The variable 'XYZ' is assigned but its value is never used
- but no compiler message for never used
- prevent compiler warning


Solution:
Just use of these lines before and after source code
#pragma warning disable
    [SOURCE CODE]
#pragma warning restore