How to solve the Microsoft SQL Server Management Studio 2008 Unable to cast COM object… on Windows 7 x64

When you open Microsoft SQL Server Management Studio 2008 on Windows 7 x64 and connect to a database instance, you get the error:

SSMS – Unable to cast COM object of type ‘System.__ComObject’ to interface type ‘Microsoft.VisualStudio.OLE.Interop.IServiceProvider’. This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{6D5140C1-7436-11CE-8034-00AA006009FA}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). (Microsoft.VisualStudio.OLE.Interop)

The problem is not the Microsoft SQL Server Management Studio 2008, but IE 8 on Windows 7, try:

The solution posted on: http://social.answers.microsoft.com/Forums/en-US/InternetExplorer/thread/e312e580-1cbc-496b-8c6b-b69b8535a7bb solved my problem

For Win 7 64 bits :
1 – Create a new notepad document and paste this text :
@echo off
echo.
echo IEREREG Version 1.07 for IE8 27.03.2009
echo by Kai Schaetzl
http://iefaq.info
echo installs and registers (if suitable) all DLLs known to be used by IE8.
echo should only take a few seconds, but please be patient
echo.
REM ******************************
echo registering IE files
REM IE files (= part of setup)
regsvr32 /s /i browseui.dll
REM regsvr32 /s /i browseui.dll,NI (unnecessary)
regsvr32 /s corpol.dll
regsvr32 /s dxtmsft.dll
regsvr32 /s dxtrans.dll
REM simple HTML Mail API
regsvr32 /s "%ProgramFiles(x86)%\internet explorer\hmmapi.dll"
REM group policy snap-in
regsvr32 /s ieaksie.dll
REM smart screen
regsvr32 /s ieapfltr.dll
REM ieak branding
regsvr32 /s iedkcs32.dll
REM dev tools
regsvr32 /s "%ProgramFiles(x86)%\internet explorer\iedvtool.dll"
regsvr32 /s iepeers.dll
REM Symptom: IE8 closes immediately on launch, missing from IE7
regsvr32 /s "%ProgramFiles(x86)%\internet explorer\ieproxy.dll"
REM no install point anymore
REM regsvr32 /s /i iesetup.dll
REM no reg point anymore
REM regsvr32 /s imgutil.dll
regsvr32 /s /i /n inetcpl.cpl
REM no install point anymore
REM regsvr32 /s /i inseng.dll
regsvr32 /s jscript.dll
REM license manager
regsvr32 /s licmgr10.dll
REM regsvr32 /s msapsspc.dll
REM regsvr32 /s mshta.exe
REM VS debugger
regsvr32 /s msdbg2.dll
REM no install point anymore
REM regsvr32 /s /i mshtml.dll
regsvr32 /s mshtmled.dll
regsvr32 /s msident.dll
REM no reg point anymore
REM regsvr32 /s msrating.dll
REM multimedia timer
regsvr32 /s mstime.dll
REM no install point anymore
REM regsvr32 /s /i occache.dll
REM process debug manager
regsvr32 /s "%ProgramFiles(x86)%\internet explorer\pdm.dll"
REM no reg point anymore
REM regsvr32 /s pngfilt.dll
REM regsvr32 /s /i setupwbv.dll (not there anymore!)
regsvr32 /s tdc.ocx
regsvr32 /s /i urlmon.dll
REM regsvr32 /s /i urlmon.dll,NI,HKLM
regsvr32 /s vbscript.dll
REM VML renderer
regsvr32 /s "%CommonProgramFiles%\microsoft shared\vgx\vgx.dll"
REM no install point anymore
REM regsvr32 /s /i webcheck.dll
regsvr32 /s /i /n wininet.dll
REM ******************************
echo registering system files
REM additional system dlls known to be used by IE
REM added 11.05.2006 Symptom: Add-Ons-Manager menu entry is present but nothing happens
regsvr32 /s extmgr.dll
REM added 12.05.2006 Symptom: Javascript links don’t work (Robin Walker) .NET hub file
regsvr32 /s mscoree.dll
REM added 23.03.2009 Symptom: Find on this page is blank
regsvr32 /s oleacc.dll
REM added 24.03.2009 Symptom: Printing problems, open in new window
regsvr32 /s ole32.dll
REM mscorier.dll
REM mscories.dll
REM Symptom: open in new tab/window not working
regsvr32 /s actxprxy.dll
regsvr32 /s asctrls.ocx
regsvr32 /s cdfview.dll
regsvr32 /s comcat.dll
regsvr32 /s /i /n comctl32.dll
regsvr32 /s cryptdlg.dll
regsvr32 /s /i /n digest.dll
regsvr32 /s dispex.dll
regsvr32 /s hlink.dll
regsvr32 /s mlang.dll
regsvr32 /s mobsync.dll
regsvr32 /s /i msieftp.dll
REM regsvr32 /s msnsspc.dll #no entry point
regsvr32 /s msr2c.dll
regsvr32 /s msxml.dll
regsvr32 /s oleaut32.dll
REM regsvr32 /s plugin.ocx #no entry point
regsvr32 /s proctexe.ocx
REM plus DllRegisterServerEx ExA ExW … ?
regsvr32 /s /i scrobj.dll
REM shdocvw.dll hasn’t been updated for IE7 and IE8, it still registers itself for the Windows Internet Controls
regsvr32 /s /i shdocvw.dll
regsvr32 /s sendmail.dll
REM ******************************
REM PKI/crypto functionality
REM initpki can take very long to run and is rarely a problem
REM if there are problems with crypto, SSL, certificates
REM remove the three following REMs from the lines
REM echo We are almost done except one crypto file
REM echo but this will take very long, be patient!
REM regsvr32 /s /i:A initpki.dll
REM ******************************
REM tabbed browser, do at the end, why originally with /n ?
regsvr32 /s /i ieframe.dll
REM ******************************
echo correcting bugs in the registry
REM do some corrective work
REM Symptom: new tabs page cannot display content because it cannot access the controls (added 27. 3.2009)
REM This is a result of a bug in shdocvw.dll (see above), probably only on Windows XP
reg add "HKCR\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32" /ve /t REG_SZ /d %systemroot%\system32\ieframe.dll /f
REM ******************************
echo all tasks have been finished
echo.
pause
2 – Close all your IE windows and processes.
3 – Save your document on your Desktop by example, with the .bat extension. Right-click on it, and select "Run as administrator".
4 – Test if this tip resolved your issue by openning IE. If you use a Windows 32 bits version, please replace %ProgramFiles(x86)% by %ProgramFiles% in your .bat file.

How to solve: IE 8 new tab hang on Connecting… on Windows 7 x64

The solution posted on: http://social.answers.microsoft.com/Forums/en-US/InternetExplorer/thread/e312e580-1cbc-496b-8c6b-b69b8535a7bb solved my problem

For Win 7 64 bits :
1 – Create a new notepad document and paste this text :
@echo off
echo.
echo IEREREG Version 1.07 for IE8 27.03.2009
echo by Kai Schaetzl
http://iefaq.info
echo installs and registers (if suitable) all DLLs known to be used by IE8.
echo should only take a few seconds, but please be patient
echo.
REM ******************************
echo registering IE files
REM IE files (= part of setup)
regsvr32 /s /i browseui.dll
REM regsvr32 /s /i browseui.dll,NI (unnecessary)
regsvr32 /s corpol.dll
regsvr32 /s dxtmsft.dll
regsvr32 /s dxtrans.dll
REM simple HTML Mail API
regsvr32 /s “%ProgramFiles(x86)%\internet explorer\hmmapi.dll”
REM group policy snap-in
regsvr32 /s ieaksie.dll
REM smart screen
regsvr32 /s ieapfltr.dll
REM ieak branding
regsvr32 /s iedkcs32.dll
REM dev tools
regsvr32 /s “%ProgramFiles(x86)%\internet explorer\iedvtool.dll”
regsvr32 /s iepeers.dll
REM Symptom: IE8 closes immediately on launch, missing from IE7
regsvr32 /s “%ProgramFiles(x86)%\internet explorer\ieproxy.dll”
REM no install point anymore
REM regsvr32 /s /i iesetup.dll
REM no reg point anymore
REM regsvr32 /s imgutil.dll
regsvr32 /s /i /n inetcpl.cpl
REM no install point anymore
REM regsvr32 /s /i inseng.dll
regsvr32 /s jscript.dll
REM license manager
regsvr32 /s licmgr10.dll
REM regsvr32 /s msapsspc.dll
REM regsvr32 /s mshta.exe
REM VS debugger
regsvr32 /s msdbg2.dll
REM no install point anymore
REM regsvr32 /s /i mshtml.dll
regsvr32 /s mshtmled.dll
regsvr32 /s msident.dll
REM no reg point anymore
REM regsvr32 /s msrating.dll
REM multimedia timer
regsvr32 /s mstime.dll
REM no install point anymore
REM regsvr32 /s /i occache.dll
REM process debug manager
regsvr32 /s “%ProgramFiles(x86)%\internet explorer\pdm.dll”
REM no reg point anymore
REM regsvr32 /s pngfilt.dll
REM regsvr32 /s /i setupwbv.dll (not there anymore!)
regsvr32 /s tdc.ocx
regsvr32 /s /i urlmon.dll
REM regsvr32 /s /i urlmon.dll,NI,HKLM
regsvr32 /s vbscript.dll
REM VML renderer
regsvr32 /s “%CommonProgramFiles%\microsoft shared\vgx\vgx.dll”
REM no install point anymore
REM regsvr32 /s /i webcheck.dll
regsvr32 /s /i /n wininet.dll
REM ******************************
echo registering system files
REM additional system dlls known to be used by IE
REM added 11.05.2006 Symptom: Add-Ons-Manager menu entry is present but nothing happens
regsvr32 /s extmgr.dll
REM added 12.05.2006 Symptom: Javascript links don’t work (Robin Walker) .NET hub file
regsvr32 /s mscoree.dll
REM added 23.03.2009 Symptom: Find on this page is blank
regsvr32 /s oleacc.dll
REM added 24.03.2009 Symptom: Printing problems, open in new window
regsvr32 /s ole32.dll
REM mscorier.dll
REM mscories.dll
REM Symptom: open in new tab/window not working
regsvr32 /s actxprxy.dll
regsvr32 /s asctrls.ocx
regsvr32 /s cdfview.dll
regsvr32 /s comcat.dll
regsvr32 /s /i /n comctl32.dll
regsvr32 /s cryptdlg.dll
regsvr32 /s /i /n digest.dll
regsvr32 /s dispex.dll
regsvr32 /s hlink.dll
regsvr32 /s mlang.dll
regsvr32 /s mobsync.dll
regsvr32 /s /i msieftp.dll
REM regsvr32 /s msnsspc.dll #no entry point
regsvr32 /s msr2c.dll
regsvr32 /s msxml.dll
regsvr32 /s oleaut32.dll
REM regsvr32 /s plugin.ocx #no entry point
regsvr32 /s proctexe.ocx
REM plus DllRegisterServerEx ExA ExW … ?
regsvr32 /s /i scrobj.dll
REM shdocvw.dll hasn’t been updated for IE7 and IE8, it still registers itself for the Windows Internet Controls
regsvr32 /s /i shdocvw.dll
regsvr32 /s sendmail.dll
REM ******************************
REM PKI/crypto functionality
REM initpki can take very long to run and is rarely a problem
REM if there are problems with crypto, SSL, certificates
REM remove the three following REMs from the lines
REM echo We are almost done except one crypto file
REM echo but this will take very long, be patient!
REM regsvr32 /s /i:A initpki.dll
REM ******************************
REM tabbed browser, do at the end, why originally with /n ?
regsvr32 /s /i ieframe.dll
REM ******************************
echo correcting bugs in the registry
REM do some corrective work
REM Symptom: new tabs page cannot display content because it cannot access the controls (added 27. 3.2009)
REM This is a result of a bug in shdocvw.dll (see above), probably only on Windows XP
reg add “HKCR\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32” /ve /t REG_SZ /d %systemroot%\system32\ieframe.dll /f
REM ******************************
echo all tasks have been finished
echo.
pause
2 – Close all your IE windows and processes.
3 – Save your document on your Desktop by example, with the .bat extension. Right-click on it, and select “Run as administrator”.
4 – Test if this tip resolved your issue by openning IE. If you use a Windows 32 bits version, please replace %ProgramFiles(x86)% by %ProgramFiles% in your .bat file.

Ajaxification of ASP .NET controls with the Telerik RadAjaxManagerProxy (Master / Content page scenario)

If you have a ASP .NET web application with a master page and a content page and you want a LinkButton to update a label with AJAX, you can use the Telerik R.A.D. controls:

Web.config


configuration > system.web > pages > controls should contain:
<add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" />

configuration > system.web > httpHandlers should contain:
<add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />

configuration > system.webServer > handlers should contain:
<add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode,runtimeVersionv2.0" />

Project

Should reference Telerik.Web.UI

Master page

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Test.master.cs" Inherits="Rvl.HelperTools.Website.Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Ajaxification with Telerik</title>
    <!-- Use a contentplaceholder in the head, for adding styling from within the user controls -->
    <asp:ContentPlaceHolder ID="head" runat="server"/>
</head>
<body>
    <form id="mainForm" runat="server">
    <div>
        <asp:ScriptManager ID="scriptManager" runat="server" />
        <!-- One RadAjaxManager for all content pages that use this master page -->
        <telerik:RadAjaxManager ID="ajaxManager" runat="server" />
        <!-- The skin should be set, else the loading panel is not shown -->
        <telerik:RadAjaxLoadingPanel ID="radAjaxLoadingPanel" runat="server" BackgroundPosition="Center" Skin="Default" />
        <asp:ContentPlaceHolder ID="mainContent" runat="server" />
    </div>
    </form>
</body>
</html>



Content page (aspx)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestContent.aspx.cs" Inherits="Rvl.HelperTools.Website.TestContent" MasterPageFile="~/Test.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <!-- Add a css class to the head of the master page -->
    <style type="text/css">
        .ViewPanel
        {
            height: 75px;
        }
    </style>
</asp:Content>
<asp:Content ID="MainContent" ContentPlaceHolderID="mainContent" runat="server">
    <!-- Use the RadAjaxManagerProxy instead of the RadAjaxManager on content pages –>
<!-- Use the RadAjaxLoadingPanel on the master page --> <telerik:RadAjaxManagerProxy ID="ajaxManagerProxy" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="changeLinkButton"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="viewPanel" LoadingPanelID="radAjaxLoadingPanel" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManagerProxy> <asp:Panel ID="viewPanel" runat="server" CssClass="ViewPanel"> <asp:Label ID="changeLabel" runat="server" Text="Default text"></asp:Label> </asp:Panel> <asp:Panel ID="actionPanel" runat="server"> <asp:LinkButton ID="changeLinkButton" runat="server" onclick="ChangeLinkButton_Click">Change</asp:LinkButton> </asp:Panel> </asp:Content>

Content page (.cs)

using System;
using System.Threading;

namespace Rvl.HelperTools.Website
{
    public partial class TestContent : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ChangeLinkButton_Click(object sender, EventArgs e)
        {
            string textChanged = "Text changed";
            string textChangedAgain = "Text changed again";

            string currentText = string.Format("{0}", changeLabel.Text);
            if (currentText.Equals(textChanged))
            {
                changeLabel.Text = textChangedAgain;
            }
            else
            {
                changeLabel.Text = textChanged;
            }
        }
    }
}

Result

image

How to change the value of a default on a column with TSQL

If you want to change the value of default on a column, you must use the ALTER TABLE syntax (DROP DEFAULT and CREATE DEFAULT should be avoided, will be removed in future releases):

-- Create a default on column 'cust_name' in table 'MyCustomer' with value 'new customer'
IF OBJECT_ID('dbo.MyCustomers') IS NOT NULL
  DROP TABLE dbo.MyCustomers
go
CREATE TABLE dbo.MyCustomers(
  cust_id int NOT NULL,
  cust_name varchar(30) NOT NULL DEFAULT ('new customer'))

-- Remove the default from column 'MyColumn1' in table 'MyTable'
declare @defaultName varchar(100), @cmd varchar(1000)
set @defaultName =
(
 select name
 from sys.objects so JOIN sys.sysconstraints sc on so.object_id = sc.constid
 where object_name(so.parent_object_id) = 'MyTable'
 and so.type = 'D'
 and sc.colid = (select column_id from sys.columns where name = 'MyColumn1' and Object_ID = Object_ID(N'MyTable'))
)
set @cmd = 'alter table MyTable drop constraint ' + @defaultName
exec(@cmd)

-- Add a default on column 'cust_name' in table 'MyCustomer' with value 'new text customer'
alter table MyCustomers add constraint DF_MyCustomers_cust_name default 'new text customer' for cust_name;

Code snippet for replacing text in database script files with C#

For deploying database content, we use database script files (TSQL *.sql). When the structure of the database changes, these script must be adjusted. To change the script I use a NUnit test, that looks like:

            StringBuilder result = new StringBuilder(string.Empty);

            // Read the contents of the file
            string fileContents = File.ReadAllText(@"..\..\..\MyDatabaseProject\Contents\Customer.sql");

            // Split in lines
            string[] lines = fileContents.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

            // Loop lines
            foreach (string line in lines)
            {
                // Determine if line starts with
                if (line.StartsWith("insert into Customer "))
                {
                    // Adjust line
                    string adjustedLine = line.Insert(76, "'");
                    adjustedLine = adjustedLine.Insert(81, "AA'");
                    adjustedLine = adjustedLine.Insert(85, "'");
                    adjustedLine = adjustedLine.Insert(90, "ZZ'");

                    // Add adjusted line to output
                    result.AppendLine(adjustedLine);
                }
                else
                {
                    // Add line to output
                    result.AppendLine(line);
                }
            }

            Console.Write(result.ToString());

How to share a printer on Windows 7 with a VMware Workstation 7 image on a NAT Network Connection

If you want to print from a VMware Workstation 7 image, which uses a NAT network connection. You can use the default Windows  printer sharing.
On the host machine: start > devices and printers > add a printer > add a local printer > create a new port > Standard TCP/IP Port >

image

Enter the ip adres of the network printer. Click on OK
Right click the created printer > Printer Properties > Sharing > Check “Share this printer”

image

On the VMware image:

start > devices and printers > add a printer > add a network printer

It will automatically show the printer, because the host computer and the VMware image share a private network with a NAT network connection

Delete all records from a table with LLBLGen Pro v2.6

If you want to delete all records from a table with LLBLGen Pro v2.6 without first fetching all records, you can use the DataAccessAdapter DeleteEntitiesDirectly function.

            // Define the query that matches all records to be deleted.
// If no PredicateExpression are added all records will be deleted.
RelationPredicateBucket bucket = new RelationPredicateBucket(); // If you want to delete only the customers that have an Id != 100, uncomment the following line // bucket.PredicateExpression.Add(CustomerFields.Id != 100); // Initialize DataAccessAdapter using (DataAccessAdapter da = new DataAccessAdapter("server=MyServer; database=Test; Trusted_Connection=False;")) { // Delete the records from table CustomerEntity (TSQL query: delete Customer) da.DeleteEntitiesDirectly("CustomerEntity", bucket); }

Configuring Internet Explorer to Remember Your SharePoint Login Credentials

See: http://blog.sharepointhosting.com/Lists/Posts/Post.aspx?ID=93

Go to Control Panel
Go to Internet Options
Click the “Security” tab
Click “Local Intranet”
Click “Sites”
Click “Advanced”
Add your SharePoint site into the “Local Intranet” zone.
Click OK to confirm on all Internet Options screens.
Open up Internet Explorer and go to your SharePoint site.  When prompted for username/password make sure you enter your credentials and check “Remember My Password”.
Your username/password should now be passed to the SharePoint site automatically.

How to copy XML nodes between documents (use ImportNode)

http://www.geekpedia.com/tutorial150_How-to-copy-XML-nodes-between-documents.html

To copy node between XmlDocuments use importnode:
// Store the root node of the destination document into an XmlNode
// The 1 in ChildNodes[1] is the index of the node to be copied (where 0 is the first node)
XmlNode rootDest = myDestDoc["DestinationRoot"];
// Store the node to be copied into an XmlNode
XmlNode nodeOrig = mySourceDoc["SourceRoot"].ChildNodes[1];
// Store the copy of the original node into an XmlNode
XmlNode nodeDest = myDestDoc.ImportNode(nodeOrig, true);
// Append the node being copied to the root of the destination document
rootDest.AppendChild(nodeDest);