Solved

Retrieving the COM class factory for component with CLSID {10020200-E260-11CF-AE68-00AA004A34D5} failed due to the following error: 80040154

Posted on 2011-02-26
3
5,296 Views
Last Modified: 2012-05-11
I am getting error as follows: Retrieving the COM class factory for component with CLSID {10020200-E260-11CF-AE68-00AA004A34D5} failed due to the following error: 80040154
The complete code is attached for clarity & complete error line as follows:
Thanks in advance for any help given.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {10020200-E260-11CF-AE68-00AA004A34D5} failed due to the following error: 80040154.
Source Error:
Line 93:             End If
Line 94:             Dim server As New SqlServer(cookie.Values("server"), cookie.Values("username"), cookie.Values("password"))
Line 95:             server.Connect()
Line 96:             Dim databases As SqlDatabaseCollection = server.Databases
Line 97:             server.Disconnect()
Source File: C:\Projects\CamsVBDev\SQLEntManData\admin\databases.aspx.vb    Line: 95
Stack Trace:
[COMException (0x80040154): Retrieving the COM class factory for component with CLSID {10020200-E260-11CF-AE68-00AA004A34D5} failed due to the following error: 80040154.]
   SqlAdmin.SqlServer.Connect() +33
   SqlWebAdmin.databases.Page_Load(Object sender, EventArgs e) in C:\Projects\CamsVBDev\SQLEntManData\admin\databases.aspx.vb:95
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Control.OnLoad(EventArgs e) +73
   System.Web.UI.Control.LoadRecursive() +52
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2184
Imports Microsoft.VisualBasic
'INSTANT VB NOTE: This code snippet uses implicit typing. 
'You will need to set 'Option Infer On' in the VB file or set 'Option Infer' at the project level:
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Collections.Specialized
Imports System.Data.SqlClient
Imports System.Linq
Imports System.Xml.Linq
Imports System.Data.Common
Imports System.IO
Imports System.Text
Imports System.Drawing
Imports System.Data.OleDb
Imports System.Globalization
Imports System.Threading
Imports System.Reflection
Imports System.Web.SessionState
Imports System.Web.Configuration
Imports System.Collections.Generic
Imports System.Text.RegularExpressions
Imports System.ComponentModel
Imports SqlAdmin

Namespace SqlWebAdmin
    ''' <summary>
    ''' Summary description for Login.
    ''' </summary>
    Partial Class databases
        Inherits System.Web.UI.Page

        Public odbName As String
        Public pDBName As String
        Public dbTableName As String
        Public osqlQuery As String
        Public psqlQuery As String
        Public connectionString As String
        Public MsgBoxDatabase As String = Nothing
        Public MsgBoxTable As String = Nothing
        Public MessageBox As String = Nothing
        Public MessageBoxProcedure As String = Nothing
        Public bDatabaseExists As Boolean = False
        Public bTableExists As Boolean = False
        Public strTable As String
        Public strTable2 As String
        Public strProcedure As String
        Public server_tb As String
        Public user_tb As String
        Public pswrd_tb As String
        Public database_tb As String
        Public table_tb As String
        Public trusted_tb As String
        Public Shared Table As New DataTable()
        Private ParameterArray As New ArrayList()
        Public kr As Integer = -1
        Public gr As Integer = -1
        Public kv As Integer = -1
        Public gv As Integer = -1
        Public kvv As Integer = -1
        Public gvv As Integer = -1
        Public iCount As Integer = 0
        Public sDBName As String = "AdminDB2"
        Public TempTable As String = "tblModule"
        Public qDBName As String
        Public qsqlQuery As String
        Protected UsernameRequiredFieldValidator As System.Web.UI.WebControls.RequiredFieldValidator
        Protected ServerRequiredFieldValidator As System.Web.UI.WebControls.RequiredFieldValidator
        Protected Sub Page_PreLoad(ByVal sender As Object, ByVal e As EventArgs)
            HttpContext.Current.Session("tablePage") = "0"
            HttpContext.Current.Session("addTable") = "0"
        End Sub
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Dim _Context As HttpContext = HttpContext.Current
            If Not Page.IsPostBack Then

            End If
            If IsPostBack Then
                osqlQuery = "Select * from AdminTable"
                pDBName = GetConnectionString(sDBName)
                qDBName = GetConnectionString(sDBName)
            End If
            Dim cookie As HttpCookie = Request.Cookies("WebDataAdministrator")
            If cookie Is Nothing Then
                Response.Redirect("default.aspx?error=sessionexpired")
            End If
            Dim server As New SqlServer(cookie.Values("server"), cookie.Values("username"), cookie.Values("password"))
            server.Connect()
            Dim databases As SqlDatabaseCollection = server.Databases
            server.Disconnect()

            ' Create DataSet from list of databases
            Dim ds As New DataSet()
            ds.Tables.Add()
            ds.Tables(0).Columns.Add("name")
            ds.Tables(0).Columns.Add("encodedname")
            ds.Tables(0).Columns.Add("size")
            For i As Integer = 0 To databases.Count - 1
                Dim database As SqlDatabase = databases(i)
                ds.Tables(0).Rows.Add(New Object() {Me.Server.HtmlEncode(database.Name), Me.Server.UrlEncode(database.Name), If(database.Size = -1, "Unknown", String.Format("{0}MB", database.Size))})
            Next i
            DatabasesDataGrid.DataSource = ds
            DatabasesDataGrid.DataBind()
        End Sub

        Public Sub BindGrid2()

        End Sub

        Public Sub BindGrid3()

        End Sub
        Protected Sub gvResults_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
            'gvResults.PageIndex = e.NewPageIndex
            BindGrid2()
        End Sub
        Protected Sub gvResults_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        End Sub
        Protected Sub DatabasesDataGrid_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
            'DatabasesDataGrid.PageIndex = e.NewPageIndex
            BindGrid3()
        End Sub
        Protected Sub DatabasesDataGrid_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        End Sub
        Public Shared Function MyString() As String
            Throw New Exception("The method or operation is not implemented.")
        End Function
        ' KM for KeyValue is defined as returning an anonymous object:
        Private Function KM(ByVal Key As String, ByVal Value As String) As Object
            Return New With {Key Key, Key Value}
        End Function
        ' KP for KeyValue is defined as returning an anonymous object:
        'Private Function KP(ByVal Key As String, ByVal Value As String) As Object
        'Return New With {Key Key, Key Value}
        Private Function KP(ByVal Value As String) As Object
            Return Value
        End Function

        Protected Overrides Sub OnInit(ByVal e As EventArgs)
            'base.OnInit(e);
            AddHandler Load, AddressOf Page_Load
            'INSTANT C# NOTE: Converted event handler wireups:
            'AddHandler TableGridView.SelectedIndexChanged, AddressOf TableGridView_SelectedIndexChanged
            'AddHandler ddlcustomer.SelectedIndexChanged, AddressOf ddlcustomer_SelectedIndexChanged
            'AddHandler ddl.SelectedIndexChanged, AddressOf ddl_SelectedIndexChanged
        End Sub

        Public Shared Function GetConnectionString(ByVal catalogName As String) As String
            Dim connectionString As String = Nothing
            Dim MyString As String = Nothing
            Dim newVariable As String = ";uid=sa;pwd=h6web97;"
            Dim newVariable1 As String = "server="
            Dim newVariable12 As String = "Initial Catalog=" & catalogName
            Dim newVariable13 As String = ";Trusted_Connection=True"
            connectionString = newVariable1 & System.Net.Dns.GetHostName() & newVariable & newVariable12 '& newVariable13
            Return connectionString
        End Function

        Public Shared Function GetConnectionString2() As String
            Dim connectionString2 As String = Nothing
            Dim MyString As String = Nothing
            Dim newVariable As String = ";uid=sa;pwd=h6web97;"
            Dim newVariable1 As String = "server="
            Dim newVariable13 As String = "Trusted_Connection=True"
            connectionString2 = newVariable1 & System.Net.Dns.GetHostName() & newVariable '& newVariable13
            Return connectionString2
        End Function
        Private Sub LoginButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles LoginButton.Click

        End Sub
        Protected Sub Button_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button.Click
            BindGrid2()
        End Sub

        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button1.Click
            BindGrid3()
        End Sub

        Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button2.Click

        End Sub

        Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button3.Click

        End Sub
        Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button4.Click

        End Sub
        Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button5.Click

        End Sub
        Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button6.Click

        End Sub
        Protected Sub Button7_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button7.Click

        End Sub
        Protected Sub Button8_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button8.Click

        End Sub
        Protected Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) 'Handles Button9.Click

        End Sub
    End Class
End Namespace

Open in new window

0
Comment
Question by:homeshopper
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Tuyau2poil earned 500 total points
ID: 34991013
that 's a sqldmo problem : SQLDMO is not X64 complient :  If your computer is a 64bits system, Try forcing .NET to run in 32-bit mode.  Project + properties, Build tab, Platform target.  Change it from "Any CPU" to "x86".  Do the same for the Release configuration.

The error can also occurs because SQL Distributed Management Objects (SQL-DMO) is not installed on your client system.
SQL-DMO is available as part of "Microsoft SQL Server 2005 Backward Compatibility Components" available from Microsoft and is available for download from:
http://www.microsoft.com/downloads/details.aspx?FamilyID=c6c3e9ef-ba29-4a43-8d69-a2bed18fe73c&displaylang=en
The web page contains a link to download the SQL-DMO component 32-bit or 64-bit systems.
hope it will help.
0
 

Author Comment

by:homeshopper
ID: 34991379
Hi Tuyau2poil,
Thank you for the link, the information was very helpfull.
It was a backward compatibility issue.
Regards, Ian
0
 

Author Closing Comment

by:homeshopper
ID: 34991547
Thank you for the link, the information was very helpfull.
It was a backward compatibility issue.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now