Link to home
Start Free TrialLog in
Avatar of homeshopper
homeshopperFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of Tuyau2poil
Tuyau2poil

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of homeshopper

ASKER

Hi Tuyau2poil,
Thank you for the link, the information was very helpfull.
It was a backward compatibility issue.
Regards, Ian
Thank you for the link, the information was very helpfull.
It was a backward compatibility issue.