December 10, 2012

IIS 7.0 ERROR on ASP Classic


ERROR: 
An error occurred on the server when processing the URL. Please contact the system administrator.

SOLUTION:
Run this command on your server ;-)
%windir%\system32\inetsrv\appcmd set config -section:asp -scriptErrorSentToBrowser:true


November 10, 2012

Fusion Active Template Library (ATL)

ERROR:
Rule "Fusion Active Template Library (ATL)" failed.
A computer restart is required because of broken fusion ATL. You must restart your computer before you continue.



SOLUTION:
Go to setup media (SQL DVD) and install this package and it'll be solved after a restart ;-)

32bit: DVD\1033_ENU_LP\x86\Setup\sqlsupport_msi\sqlsupport.msi
64bit: DVD\1033_ENU_LP\x64\Setup\sqlsupport_msi\sqlsupport.msi

November 09, 2012

SQL Server cannot process this media family


ERROR:
Specified Cast is not valid (SqlManagerUI)

ERROR:
Msg 3241, Level 16, State 13, Line 1
The media family on device 'D:\1.bak' is incorrectly formed. SQL Server cannot process this media family.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

CAUSE:
- Microsoft SQL Database fails to restore from higher ms-sql version
- Restoring the backup from SQL 2008 to SQL 2005 instance
- Restoring SQL backup file from SQL 2012 to SQL 2008

SOLUTION:
- Upgrade your destination sql server to upper version
- Prepare SQL data script instead of sql data backup file

October 29, 2012

Load an assembly from a network location


Error:
Exception Message: Could not load file or assembly 'file:///Z:\PROJECT\bin\Debug\XYZ.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

Exception Message: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.


System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.


Solution:
It will be solved if you add a simple magic ;-) line to YOURPROJECT.exe.config file 
- Open YOURPROJECT.exe.config file from bin folder
- Add <loadFromRemoteSources enabled="true" /> to <runtime> tag

October 18, 2012

CREATE FILE encountered operating system error 5


Problem:
- CREATE FILE encountered operating system error 5(Access is denied.)
- CREATE FILE encountered operating system error 5(failed to retrieve text for this error. Reason: 15105) while attempting to open or create the physical file 'PATH\FILE.mdf'.
- CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file 'PATH\FILE.mdf'.

Solution:
- Go to Control Panel > Administrative Tools > Services
- Right click on SQL SERVER (BLAH BLAH) and select the Properties
- Stop service
- Go to Log On tab and change the Log on as: to Local System Account
- Apply and Start service again ans enjoy ;-)

October 16, 2012

Operation could destabilize the runtime


Problem:
- Devexpres has problem ... operation could destabilize the runtime
- have operation could destabilize the runtime with DXWindow ... devexpress
- devexpress problem with Visual Studio 2012


Solution:
There's just one solution, Upgrade to Devexpress v2012.1.6 and next versions ;-)

October 09, 2012

Mismatch between the processor architecture


Warning
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "PATH\PROJECT.dll", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

Solution
1- In Visual Studio menu go to Build > Configuration Manager...
2- go to Platform column and select all x86 (it must be changed to Any CPU)
3- Click on <New...> and Select Any CPU
4- That's it, Compile All and Be Happy ;-)

October 05, 2012

The underlying connection was closed

Problem:
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.


Solution:
Just add this line in your codes

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate{return true;});

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

August 20, 2012

DevExpress ChartControl Printing

Problem:
- How to print DevExpress ChartControl ...
- How to printing ChartControl
- Print of DXChart ....
- How to print of DevExpress WPF ChartControl
- How to print DevExpress ChartControl via SimpleLink (DXPrinting) ...
- Print Preview a WPF Chart and Show Its
- WPF Chart Control - Print of DevExpress DXCharts for WPF

Solution:
Yes, it's simple. just call below method with chart control ;-)
private void PrintChartControl(ChartControl chartControl, bool withPreview = true)
{
    /// Prepare Template
    var templateImage = new FrameworkElementFactory(typeof(ImageEdit));
    templateImage.SetBinding(ImageEdit.SourceProperty, new Binding("Content"));
    DataTemplate templateData = new DataTemplate() { VisualTree = templateImage };
    /// Prepare Simple Link
    SimpleLink simpleLink = new DevExpress.Xpf.Printing.SimpleLink();
    simpleLink.DetailCount = 1;
    simpleLink.DetailTemplate = templateData;
    simpleLink.CreateDetail += new EventHandler<CreateAreaEventArgs>((sl_s, sl_e) =>
    {
        DrawingVisual vDrawing = new DrawingVisual();
        DrawingContext context = vDrawing.RenderOpen();
        context.DrawRectangle(new VisualBrush(chartControl), null, new Rect(0, 0, chartControl.ActualWidth, chartControl.ActualHeight));
        context.Close();
        RenderTargetBitmap bmp = new RenderTargetBitmap((int)chartControl.ActualWidth, (int)chartControl.ActualHeight, 96, 96, PixelFormats.Pbgra32);
        bmp.Render(vDrawing);
        sl_e.Data = bmp;
    });
    simpleLink.Landscape = true;
    simpleLink.CreateDocument(true);
    if (withPreview == true)
    {
        simpleLink.ShowPrintPreviewDialog(this);
    }
    else
    {
        simpleLink.Print();
    }
}

August 11, 2012

The tag does not exist in XML namespace


Error:
The tag 'XXX' does not exist in XML namespace 'clr-namespace:YYY;assembly=YYY'. Line zz Position zz.


Solution:
I know, it's really weird, but the solution is simple. Just change
FROM:
xmlns:ZZZ="clr-namespace:YYY;assembly=YYY"
TO:
xmlns:ZZZ="clr-namespace:YYY;assembly="
leave empty value for assembly=

August 10, 2012

Lunch Condition


Problems: 
- Install .Net Framework in Setup Project ...
- Adding Dot Net Framework to the Setup Project in ...
- Install .NET Framework with Visual Studio .NET ...
- Create setup project that includes .Net Framework 3.5 ...
- How to attach .Net framework 4.0 client profile to my setup project?
- Setup project wants to install .NET 4
- How to include .NET framework redistributable in Visual Studio setup ....
- Setup project: where .net framework 4.0 is
- Add Prerequisites of .NET Framework in Visual Studio Setup Project ...
- .Net 2.0 or 3.5 Setup Project Requires .Net Framework version 4.0

Solutions:
Windows Installer 3.1 (With Local Prerequisite)
Name: Windows Installer 3.1
Condition: VersionMsi >= "3.1"
InstallUrl: WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe
Message: Windows Installer 3.1 is required to run this setup

Windows Installer 3.1
Name: Windows Installer 3.1
Condition: VersionMsi >= "3.1"
InstallUrl: go.microsoft.com/fwlink/?LinkId=42467
Message: Windows Installer 3.1 is required to run this setup

Windows Installer 4.5 (With Local Prerequisite)
Name: Windows Installer 4.5
Condition: VersionMsi >= "4.05"
InstallUrl: WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe
Message: Windows Installer 4.5 is required to run this setup

Windows Installer 4.5
Name: Windows Installer 4.5
Condition: VersionMsi >= "4.05"
InstallUrl: http://go.microsoft.com/fwlink/?LinkId=120486
Message: Windows Installer 4.5 is required to run this setup

.NET Framework (With Local Prerequisite)
Name: .NET Framework
InstallUrl: DotNetFX40Client\dotNetFx40_Client_x86_x64.exe
Version: .NET Framework 4 Client Profile
Message: [VSDNETMSG]

PS: '.NET Framework' condition is a automatic added condition after add a .Net Project to Setup Project

August 08, 2012

Unable to update the EntitySet

Error:
Unable to update the EntitySet 'XYZ' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.

Solution:
Just add Primary Key for your Table in Database or DataModel (edmx file).

August 07, 2012

Change Entity Framework ConnectionString‎

Problem: 
- Dynamically change Entity Framework Connection String‎
- How to change the connection string in the EntityFramework ...
- How should I edit an Entity Framework connection string ...
- change db name in connection string at runtime in Entity Framework
- Cannot change the connectionstring with Entity Framework 4.1 code ...
- Entity Framework - how can I change connection string to be relative?
- Entity Framework Connection String Trouble - Stack Overflow

Solution:
Just add System.Configuration.dll to Refrences of your Project and then use of this code
ConfigurationManager.ConnectionStrings[0].ConnectionString = blah blah blah
ConfigurationManager.ConnectionStrings["XYZEntities"].ConnectionString = blah blah blah

Error in Solution:
Error: 
The configuration is read only.
Correction: 

var Configuration = ConfigurationManager.ConnectionStrings["amaBoxOfficeEntities"];
typeof(ConfigurationElement).GetField("_bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Configuration, false);
Configuration.ConnectionString = blah blah blah


Install Window Without DVD or USB


Problem:
How to install Window 7 without DVD
How to install Window from network

Solution:
1- Download and Run TFTPBoot.exe
link: http://blog.ryantadams.com/wp-content/uploads/tftpboot.exe
link: http://www.megaupload.com/?d=V04T7KQ8
2- Change all settings (follow these screen shots)


3- Turn-on destination computer and press F12
4- after Windows Started ... type this command (on destination computer)
net use Y: \\10.0.0.102\E [PRESS ENTER]
PS: IP and Path are related your source computer
PS: After this prompt you need to enter username and password like COMPUERNAME\Administrator and password
5- Go to share folder and start windows setup ... (with these commands)
Y: [PRESS ENTER]
SETUP [PRESS ENTER]

References:
link: http://blog.ryantadams.com/2008/02/01/how-to-boot-from-the-network-pxe-boot-with-tftp-and-windows-pe
link: http://blog.dustinriley.net/2009/03/17/installing-windows-7-on-hp-mini-1000-through-network
link: http://www.expertcore.org/viewtopic.php?f=15&t=2560

July 07, 2012

Cannot set XYZ attribute value


Error:
Cannot set Name attribute value 'gridColumn01' on element 'GridColumn'. 'GridColumn' is under the scope of element 'AmaEntityGridView', which already had a name registered when it was defined in another scope.



Solution:
Change Name or other field to x:Name or other prefix like below

Example 1:
WRONG: <x:A Name="xyz"
SOLUTION: <x:A x:Name="xyz"

Example 2:
WRONG: <dxg:GridColumn Name="xyz"
SOLUTION: <dxg:GridColumn dxg:GridColumn.Name="xyz"

June 25, 2012

Only TrueType fonts are supported


Error:
Only TrueType fonts are supported. This is not a TrueType font.
ArgumentException was unhandled by user code


Solution:
Add these lines before FontDialog ShowDialog
fontDialog.AllowSimulations = false;
fontDialog.AllowScriptChange = false;

June 20, 2012

Unable to update the EntitySet Error


Error:
Unable to update the EntitySet 'XYZ' because it has a DefiningQuery and no <DeleteFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.


Solution:
Don't forget the PrimaryKey for your Table.
:-D, Yes, It's simple, just set the Primary Key in Database (and update your EF)

June 18, 2012

Stop Visual Studio after build when error occurs


Errors:
- Visual Studio and Stop running after build when error occurs
- How to stop run application after 'build and run' with error(s)
- Oops, My visual studio continues and run the last successful build, is it...


Solutions:
Go to Microsoft Visual Studio (2005, 2008 or 2010) > Tools > Options... > Projects and Solutions > Build and Run > and then
1- On Run, when projects are out of date > Prompt to build is default setting
2- On Run, when build or deployment errors occur > Prompt to launch is default setting

June 02, 2012

Unable to update the EntitySet


Error:
Unable to update the EntitySet 'TABLE_NAME' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.


Solution:
You have forgotten to set the PrimeryKey for this Table in DBMS like SQL Server

May 22, 2012

BeginGroup in WPF Devexpress Ribbon


Problem:
- I can't find "BeginGroup" in WPF Ribbon! is there any solution ...
- Does the silverlight ribbon bar items have the begingroup option? Can't find it anywhere.
- How do you do a BeginGroup in the application menu using WPF or SL ...

Solution:
Just used of a BarItemLinkSeparator in XAML instead of BeginGroup property.

XAML:
<dxr:RibbonPageGroup>
    <dxb:BarButtonItemLink BarItemName="barButtonItemFind" />
    <dxb:BarButtonItemLink BarItemName="barButtonItemBookmark" />
    <dxb:BarItemLinkSeparator />
    <dxb:BarButtonItemLink BarItemName="barButtonItemFirst"/>
    <dxb:BarButtonItemLink BarItemName="barButtonItemPrevious" />
    <dxb:BarButtonItemLink BarItemName="barButtonItemNext" />
    <dxb:BarButtonItemLink BarItemName="barButtonItemLast" />
</dxr:RibbonPageGroup>

May 19, 2012

The argument types 'Edm.Guid' and 'Edm.String' are incompatible


Error:
- The argument types 'Edm.Guid' and 'Edm.String' are incompatible for this operation. Near equals expression, line X, column Y.
- ObjectQuery<T>.Where problem with GUID
- Where filter predicate format is not match with GUID and ...

Solution:
The GUID format in where clause must be started with GUID term and covered with single quotation, like below

X.Where("it.ID = GUID'00000000-0000-0000-0000-000000000001'");

May 18, 2012

WPF Window Maximize problem


Problem
- The WPF application Maximize Problem and not work correctly
- The WindowState="Maximized" make window bigger than screen size and ...
- After loaded the window, it comes bigger than whole screen size and ...
- I created a WPF window and I'm running into maximizing problems.
- Problem in Maximize state
- Fully Maximize WPF Window using windowstate is not working

Solution
Just remove below line from XAML code.
SizeToContent="WidthAndHeight"
Or add below line after InitializeComponent(); in constructor
SizeToContent=System.Windows.SizeToContent.Manual;

April 15, 2012

Grouping Problem in GridControl


Problem
- Devexpress WPF GridControl Grouping Problem
- Problem WPF DXGrid with CollectionViewSource
- GridControl can't grouping
- WPF DataGrid through EF Can't support grouppoing
- DXGrid grouping problem with CollectionViewSource
- Devexpress WPF GridControl have problem with grouping
- Grouping Columns not working in dxg:GridControl

Solution
1- It has a simple, just add CollectionViewType to CollectionViewSource like below
 <CollectionViewSource CollectionViewType="ListCollectionView" x:Key="X" />    
2- Don't use of CollectionViewSource and set directly the Grid ItemSource.

Reference
HelpLink: http://www.devexpress.com/Support/Center/p/Q382933.aspx

March 17, 2012

KMPlayer Audio Problem

Problem
- Solve kmplayer mkv audio problem
- How to fix KMPlayer Audio noise
- How to find out the problem of MKV video format audio noise
- When i play the mkv video file, strange noise is mixed with voice ...
- .mkv plays with noise in KMPlayer but in other player it's fine!

Solution
You must to find out the Audio Decoder and change it. Follow me
1- Play the video
2- Press Ctrl + Tab (Advance Playback Info)

3- Read the Audio Decoder Name (in this case it's ACC)
4- Press F2 (Preferences)
5- Goto Filter Control > Decoder Usage > Internal Audio Decoder > Unchecked the Audio Decoder (in this case it's ACC)

6- Close and Close and Open the video again ;-)


March 02, 2012

List of EventHandler

System.Windows.Controls (WPF)
  • CleanUpVirtualizedItemEventHandler
  • ContextMenuEventHandler
  • DataGridSortingEventHandler
  • GroupStyleSelector
  • InitializingNewItemEventHandler
  • InkCanvasGestureEventHandler
  • InkCanvasSelectionChangingEventHandler
  • InkCanvasSelectionEditingEventHandler
  • InkCanvasStrokeCollectedEventHandler
  • InkCanvasStrokeErasingEventHandler
  • InkCanvasStrokesReplacedEventHandler
  • ScrollChangedEventHandler
  • SelectedCellsChangedEventHandler
  • SelectionChangedEventHandler
  • TextChangedEventHandler
  • ToolTipEventHandler

System.Windows.Controls (WPF)
  • AutoResizedEventHandler
  • CoerceValueCallback
  • DataObjectCopyingEventHandler
  • DataObjectPastingEventHandler
  • DataObjectSettingDataEventHandler
  • DependencyPropertyChangedEventHandler
  • DragEventHandler
  • ExitEventHandler
  • GiveFeedbackEventHandler
  • PropertyChangedCallback
  • QueryContinueDragEventHandler
  • RequestBringIntoViewEventHandler
  • RoutedEventHandler
  • RoutedPropertyChangedEventHandler <T >
  • SessionEndingCancelEventHandler
  • SizeChangedEventHandler
  • SourceChangedEventHandler
  • StartupEventHandler
  • ValidateValueCallback

This story... to be continued ;-)

February 29, 2012

Speed Up File Copy in Windows 7

1- Disable Auto-tuning
Command: netsh interface tcp set global autotuninglevel=disabled

2- Remove RDC
Control Panels > Programs and Features > Turn Windows features on or off > Unchecked Remote Differential Compression

3- Remove IPv6
Control Panel > Network and Sharing Center > Change adaptor settings > Right click on your enabled network >  Properties > Uncheked Internet Protocol Version 6 (TCP/IPv6)

4- Clear DNS Cache
Command: ipconfig /flushdns

February 28, 2012

Print DOS Application With Windows Printer

Problem
- How can i print with laser and inkjet printers with MS-DOS Application
- How to print with old DOS programs

Solution A
The DOSPRN can help you ;-)
Site: www.dosprn.com
FAQ: www.dosprn.com/faq.htm

Solution B
Download the PRN2FILE and run it in DOS mode. This resident DOS application converts the print task to PRN file.
You can use of below command for save print task in 1.PRN.
Command: prn2file.com C:\1.PRN
For start automatically in each start command in windows you can append the above command in end of %windir%\system32\autoexec.nt file.
Site: cejvik.xf.cz/prilohy/dos_usb_print_prn/
Link ver1.0: cejvik.xf.cz/prilohy/dos_usb_print_prn/prn2file.zip
Link ver1.0: http://www.4shared.com/rar/j2SARDvj/20120228-prn2file.html
Link ver1.1 (+modification):  ftp://ftp.simtel.net/pub/simtelnet/msdos/printer/prn2fil3.zip
Link ver1.1 (+modification):  http://www.4shared.com/zip/r9vT8VwT/20120303-prn2file11.html

Usage (v1.0): PRN2FILE [path][filename][/Pn][/Bnn][/F][/A][/U]
Run PRN2FILE with the desired filename to activate it.
Run it with a different filename to change destination file.
/P to designate the printer number (defaults to 1)
/B to enter buffer size in K bytes (defaults to 4)
/F to print just to file and not to printer (default is both) [in v1.1 only]
/A to append to file (default is to create new file) [in v1.1 only]
/U to uninstall the program

February 22, 2012

Connection is busy with results for another hstmt

Problem
- What's this ERROR [HY000] [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt
- I have problem with OdbcCommand in C# ...
- The {System.Data.Odbc.OdbcErrorCollection} error comes after ExecuteReader


Solution A
Add a  SET NOCOUNT ON in first line of CommandText of your Command

Solution B
Change ExecuteReader() to ExecuteNonQuery() or ExecuteScalar()

January 20, 2012

No row was updated

Error:
- A SQL Server Database contains some tables but one of table's rows cannot be updated!!
- How i can update some NULL rows in my table ?
- Can't update rows (...) in Microsoft Visual Studio ...

Error Message:
No row was updated.
The data in row X was not committed.
Error Source: Microsoft.VisualStudio.DataTools.
Error Message: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(N rows).
Correct the errors and retry or press ESC to cancel the change(s).
Problem Causes:
This issue occurs if the following conditions are true:
- The table contains one or more columns of the text or ntext data type.
- The value of one of these columns contains the following characters:
        - Percent sign (%)
        - Underscore (_)
        - Left bracket ([)
- The table does not contain a primary key.

Solution:
This is a Microsoft BUG (BUG-925719)
There's not any solution. You need to have a new table with a primary key or correct values and copy data into new table and drop old table, Sorry.


Solution In Microsoft Visual Studio 
(NEW):

- Goto Server Explorer
- Goto Database > Tables > The Table
- RightClick and Select Edit Table Schema
ADD a new Column with these options
        - Data Type: uniqueidentifier
        - Allow Nulls: No
        - Unique: Yes
        - Primary Key: Yes
        - Is RowGuid: True
- Save and Close and open Table and update rows ;-)


REF: 
http://amastaneh.blogspot.com/2012/01/no-rows-were-deleted.html

January 19, 2012

No rows were deleted

Error:
- A SQL Server Database contains some tables but one of table's rows cannot be deleted!!
- How i can delete some NULL rows in my table ?
- Can't delete rows (...) in Microsoft Visual Studio ...

Error Message:
No rows were deleted.
A problem occured attempting to delete row 3.
Error Source: Microsft.VisualStudio.DataTools.
Error Message: The row value(s) updated or deleted either do not make
the row unique or they alter multiple rows (3 rows)
Correct the errors and attempt to delete rows again or press ESC to cancel the change(s)
Problem Causes:
This issue occurs if the following conditions are true:
- The table contains one or more columns of the text or ntext data type.
- The value of one of these columns contains the following characters:
      - Percent sign (%)
      - Underscore (_)
      - Left bracket ([)
- The table does not contain a primary key.

Solution:
This is a Microsoft BUG (BUG-925719)
There's not any solution. You need to have a new table with a primary key or correct values and copy data into new table and drop old table, Sorry.

Solution In Microsoft Visual Studio (NEW):
- Goto Server Explorer
- Goto Database > Tables > The Table
- RightClick and Select Edit Table Schema
- ADD a new Column with these options
        - Data Type: uniqueidentifier
        - Allow Nulls: No
        - Unique: Yes
        - Primary Key: Yes
        - Is RowGuid: True
- Save and Close and open Table and delete rows ;-)

REF: http://amastaneh.blogspot.com/2012/01/no-row-was-updated.html

January 07, 2012

Database does not have a valid owner


Error:
TITLE: Microsoft SQL Server Management Studio
Database diagram support objects cannot be installed because this database does not have a valid owner.  To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
BUTTONS:
OK


Solution:
A really short, simple and easy solution is, change the database owner to "sa" like below image