Regarding exception -Message "The type initializer for "eradllc.maindbtest.DataProvider" threw an exception." String

Hi I am facing following exception when developing a module ie,

 

 

 

                Message               "The type initializer for

"eradllc.maindbtest.DataProvider" threw an exception."          String

 

 

 

.This is when I want to send two string values(textbox values with a button

click)  to database. I am sending my code .my namespace is

eradllc.maindbtest

 

 

 

 

 

This is main page ---- maindb

 

 

 

Imports DotNetNuke

 

Imports DotNetNuke.Common

 

Imports DotNetNuke.Common.Utilities

 

Imports DotNetNuke.Services.Exceptions

 

Imports DotNetNuke.Entities.Users

 

Imports DotNetNuke.Framework

 

Imports DotNetNuke.UI

 

Imports eradllc

 

Imports System.Web.UI.WebControls

 

Imports DotNetNuke.Services.Localization

 

 

 

 

 

 

 

Namespace eradllc.maindbtest

 

 

 

 

 

    Public MustInherit Class maindb

 

        Inherits Entities.Modules.PortalModuleBase

 

        Implements Entities.Modules.IActionable

 

 

 

        Protected WithEvents txtname As System.Web.UI.WebControls.TextBox

 

        Protected WithEvents txtaddress As System.Web.UI.WebControls.TextBox

 

        Protected WithEvents btn_cancel As System.Web.UI.WebControls.Button

 

        Protected WithEvents btnadd As System.Web.UI.WebControls.Button

 

        Protected WithEvents btn_view As System.Web.UI.WebControls.Button

 

 

 

#Region "Private Members"

 

 

 

        Private itemId As Integer = 2

 

 

 

 

 

 

 

#End Region

 

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Load

 

            Try

 

 

 

            Catch ex As Exception

 

 

 

            End Try

 

        End Sub

 

 

 

 

 

        Private Sub btn_Cancel_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs)

 

            Try

 

                Response.Redirect(EditUrl("Second"), True)

 

            Catch exc As Exception    'Module failed to load

 

 

 

                ProcessModuleLoadException(Me, exc)

 

            End Try

 

        End Sub

 

 

 

        Private Sub btnadd_Click(ByVal sender As Object, ByVal e As

EventArgs) Handles btnadd.Click

 

            Try

 

                Dim ModuleId As Integer = 365

 

                Dim objmaindbcon As New maindbcontroller

 

                Dim objmaindbinfo As New maindbinfo

 

                objmaindbinfo.ItemId = itemId

 

                objmaindbinfo.ModuleId = ModuleId

 

                objmaindbinfo.Name = txtname.Text

 

                objmaindbinfo.Address = txtaddress.Text

 

                ' If itemId = -1 Then

 

                '' Add the contact within the contacts table

 

                objmaindbcon.AddAddress(objmaindbinfo)

 

 

 

                ' Else

 

                '  Response.Redirect(EditUrl(""))

 

                'End If

 

 

 

 

 

 

 

 

 

 

 

            Catch exc As Exception    'Module failed to load

 

 

 

                ProcessModuleLoadException(Me, exc)

 

            End Try

 

        End Sub

 

 

 

        Private Sub InitializeComponent()

 

 

 

        End Sub

 

 

 

        Private Sub btn_view_Click(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles btn_view.Click

 

            Response.Redirect(EditUrl("edit"))

 

        End Sub

 

 

 

        'Public ReadOnly Property ModuleActions() As

DotNetNuke.Entities.Modules.Actions.ModuleActionCollection Implements

DotNetNuke.Entities.Modules.IActionable.ModuleActions

 

        '    Get

 

        '        Dim Actions As New

Entities.Modules.Actions.ModuleActionCollection

 

        '        Actions.Add(GetNextActionID,

Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent,

LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent,

"", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)

 

        '        Return Actions

 

 

 

        '    End Get

 

        'End Property

 

#Region "Optional Interfaces"

 

 

 

        Public ReadOnly Property ModuleActions() As

Entities.Modules.Actions.ModuleActionCollection Implements

Entities.Modules.IActionable.ModuleActions

 

            Get

 

                Dim Actions As New

Entities.Modules.Actions.ModuleActionCollection

 

                Actions.Add(GetNextActionID,

Localization.GetString(Entities.Modules.Actions.ModuleActionType.AddContent,

LocalResourceFile), Entities.Modules.Actions.ModuleActionType.AddContent,

"", "", EditUrl(), False, Security.SecurityAccessLevel.Edit, True, False)

 

                Return Actions

 

            End Get

 

        End Property

 

 

 

#End Region

 

 

 

    End Class

 

End Namespace

 

 

 

 

 

 

 

This is controller class

 

 

 

 

 

 

 

Imports DotNetNuke.Services.Search

 

Imports System

 

Imports System.Configuration

 

Imports System.Data

 

Imports System.XML

 

Imports DotNetNuke

 

Imports DotNetNuke.Common

 

Imports DotNetNuke.Common.Utilities

 

Imports DotNetNuke.Services.Exceptions

 

Imports DotNetNuke.Entities.Users

 

Imports DotNetNuke.Framework

 

Imports DotNetNuke.UI

 

Imports eradllc

 

 

 

 

 

 

 

 

 

 

 

 

 

    Namespace eradllc.maindbtest

 

        Public Class maindbcontroller

 

            'Implements Entities.Modules.ISearchable

 

            'Implements Entities.Modules.IPortable

 

            'Implements Entities.Modules.IActionable

 

 

 

 

 

#Region "Public Methods"

 

 

 

            Public Sub AddAddress(ByVal objmaindb As maindbinfo)

 

 

 

                'DataProvider.Instance().AddContact(objcontact.ModuleId,

objcontact.CreatedByUser, objcontact.Name, objcontact.Role,

objcontact.Email, objcontact.Contact1, objcontact.Contact2)

 

            DataProvider.Instance().AddAddress(objmaindb.ModuleId,

objmaindb.Name, objmaindb.Address)

 

 

 

 

 

            End Sub

 

#End Region

 

            'Public Function GetSearchItems(ByVal ModInfo As

Entities.Modules.ModuleInfo) As Services.Search.SearchItemInfoCollection

Implements Entities.Modules.ISearchable.GetSearchItems

 

 

 

            '    Dim SearchItemCollection As New SearchItemInfoCollection

 

 

 

            '    Dim Contacts As ArrayList = GetContacts(ModInfo.ModuleID)

 

 

 

            '    Dim objContact As Object

 

            '    For Each objContact In Contacts

 

            '        Dim SearchItem As SearchItemInfo

 

            '        With CType(objContact, ContactInfo)

 

            '            '

 

            '            Dim UserId As Integer = Null.NullInteger

 

            '            If IsNumeric(.CreatedByUser) Then

 

            '                UserId = Integer.Parse(.CreatedByUser)

 

            '            End If

 

            '            SearchItem = New

SearchItemInfo(ModInfo.ModuleTitle, .Name, UserId, .CreatedDate,

ModInfo.ModuleID, .ItemId.ToString, .Name & " " & .Role & " " & .Email & " "

& .Contact1 & " " & .Contact2, "ItemId=" & .ItemId.ToString)

 

            '            SearchItemCollection.Add(SearchItem)

 

            '        End With

 

            '    Next

 

 

 

            '    Return SearchItemCollection

 

            'End Function

 

        End Class

 

    End Namespace

 

 

 

 

 

 

 

****************************************************************************

*************This is info page

 

 

 

 

 

Imports System

 

Imports System.Configuration

 

Imports System.Data

 

Imports DotNetNuke

 

Imports DotNetNuke.Common

 

Imports DotNetNuke.Common.Utilities

 

Imports DotNetNuke.Services.Exceptions

 

Imports DotNetNuke.Entities.Users

 

Imports DotNetNuke.Framework

 

Imports DotNetNuke.UI

 

Imports eradllc

 

 

 

 

 

 

 

 

 

    Namespace eradllc.maindbtest

 

 

 

        Public Class maindbinfo

 

 

 

#Region "Private Members"

 

 

 

            Private _ItemId As Integer

 

            Private _ModuleId As Integer

 

            Private _Name As String

 

            Private _Address As String

 

 

 

#End Region

 

#Region "Constructors"

 

 

 

            Public Sub New()

 

            End Sub

 

 

 

#End Region

 

#Region "Public properties"

 

            Public Property ItemId() As Integer

 

                Get

 

                    Return _ItemId

 

                End Get

 

                Set(ByVal Value As Integer)

 

                    _ItemId = Value

 

                End Set

 

            End Property

 

 

 

            Public Property ModuleId() As Integer

 

                Get

 

                    Return _ModuleId

 

                End Get

 

                Set(ByVal Value As Integer)

 

                    _ModuleId = Value

 

                End Set

 

            End Property

 

            Public Property Name() As String

 

                Get

 

                    Return _Name

 

                End Get

 

                Set(ByVal Value As String)

 

                    _Name = Value

 

                End Set

 

            End Property

 

            Public Property Address() As String

 

                Get

 

                    Return _Address

 

                End Get

 

                Set(ByVal Value As String)

 

                    _Address = Value

 

                End Set

 

            End Property

 

#End Region

 

 

 

 

 

 

 

 

 

 

 

        End Class

 

    End Namespace

 

 

 

 

 

 

 

 

 

This is DataProvider class

 

 

 

Imports System

 

Imports DotNetNuke

 

Namespace eradllc.maindbtest

 

    Public MustInherit Class DataProvider

 

#Region "Shared/Static Methods"

 

 

 

        ' singleton reference to the instantiated object

 

        Private Shared objProvidertest As DataProvider = Nothing

 

 

 

        ' constructor

 

        Shared Sub New()

 

            CreateProvider()

 

        End Sub

 

 

 

        ' dynamically create provider

 

        Private Shared Sub CreateProvider()

 

            objProvidertest =

CType(Framework.Reflection.CreateObject("data", "eradllc.maindbtest",

"erad.adddb"), DataProvider)

 

        End Sub

 

 

 

        ' return the provider

 

        Public Shared Shadows Function Instance() As DataProvider

 

            Return objProvidertest

 

        End Function

 

 

 

#End Region

 

#Region "Abstract methods"

 

 

 

 

 

        Public MustOverride Sub AddAddress(ByVal ModuleId As Integer, ByVal

Name As String, ByVal Address As String)

 

 

 

 

 

 

 

#End Region

 

 

 

 

 

    End Class

 

End Namespace

 

 

 

 

 

 

 

 

 

 

 

This is  SqlDataProvider class

 

 

 

Imports System

 

Imports System.Data

 

Imports System.Data.SqlClient

 

Imports Microsoft.ApplicationBlocks.Data

 

Imports eradllc.maindbtest

 

Imports DotNetNuke

 

Imports DotNetNuke.Common

 

Imports DotNetNuke.Common.Utilities

 

Imports DotNetNuke.Services.Exceptions

 

Imports DotNetNuke.Entities.Users

 

Imports DotNetNuke.Framework

 

Imports DotNetNuke.UI

 

Imports eradllc

 

Imports DotNetNuke.Services.Localization

 

Namespace eradllc.maindbtest

 

 

 

    Public Class SqlDataProvider

 

 

 

 

 

        Inherits DataProvider

 

 

 

#Region "Private Members"

 

 

 

        Private Const ProviderType As String = "data"

 

 

 

        Private _providerConfiguration As

Framework.Providers.ProviderConfiguration =

Framework.Providers.ProviderConfiguration.GetProviderConfiguration(ProviderT

ype)

 

        Private _connectionString As String

 

        Private _providerPath As String

 

        Private _objectQualifier As String

 

        Private _databaseOwner As String

 

 

 

#End Region

 

 

 

#Region "Constructors"

 

 

 

        Public Sub New()

 

 

 

            ' Read the configuration specific information for this provider

 

            Dim objProvider As Framework.Providers.Provider =

CType(_providerConfiguration.Providers(_providerConfiguration.DefaultProvide

r), Framework.Providers.Provider)

 

 

 

            ' Read the attributes for this provider

 

            If objProvider.Attributes("connectionStringName") <> "" AndAlso

_

 

 

System.Configuration.ConfigurationSettings.AppSettings(objProvider.Attribute

s("connectionStringName")) <> "" Then

 

                _connectionString =

System.Configuration.ConfigurationSettings.AppSettings(objProvider.Attribute

s("connectionStringName"))

 

            Else

 

                _connectionString =

objProvider.Attributes("connectionString")

 

            End If

 

            _providerPath = objProvider.Attributes("providerPath")

 

 

 

            _objectQualifier = objProvider.Attributes("objectQualifier")

 

            If _objectQualifier <> "" And _objectQualifier.EndsWith("_") =

False Then

 

                _objectQualifier += "_"

 

            End If

 

 

 

            _databaseOwner = objProvider.Attributes("databaseOwner")

 

            If _databaseOwner <> "" And _databaseOwner.EndsWith(".") = False

Then

 

                _databaseOwner += "."

 

            End If

 

 

 

        End Sub

 

 

 

#End Region

 

 

 

#Region "Properties"

 

 

 

        Public ReadOnly Property ConnectionString() As String

 

            Get

 

                Return _connectionString

 

            End Get

 

        End Property

 

 

 

        Public ReadOnly Property ProviderPath() As String

 

            Get

 

                Return _providerPath

 

            End Get

 

        End Property

 

 

 

        Public ReadOnly Property ObjectQualifier() As String

 

            Get

 

                Return _objectQualifier

 

            End Get

 

        End Property

 

 

 

        Public ReadOnly Property DatabaseOwner() As String

 

            Get

 

                Return _databaseOwner

 

            End Get

 

        End Property

 

 

 

#End Region

 

 

 

#Region "Public Methods"

 

 

 

        Public Overrides Sub AddAddress(ByVal ModuleId As Integer, ByVal

Name As String, ByVal Address As String)

 

            'SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner &

ObjectQualifier & "SPAddAddress", ModuleId, Name, Address)

 

            SqlHelper.ExecuteNonQuery(ConnectionString,

"dbo.SPAddAddresstest", ModuleId, Name, Address)

 

            'Dim con As New

SqlConnection("Server=eraddev03;Database=eradtest;uid=sa;pwd=OnTime;")

 

            'Dim str As String

 

            'str=DatabaseOwner& "SPAddAddress"

 

 

 

            'SqlHelper.ExecuteNonQuery(con, DatabaseOwner & ObjectQualifier

& "SPAddAddress",ModuleId, Name, Address)

 

 

 

        End Sub

 

 

 

 

 

#End Region

 

 

 

    End Class

 

 

 

End Namespace

 

 

 

 

 

 

 

 

 

Pls   verify code and give me advice

 

 

 

 

 

Thanks

 

Navin

 

 

 


Navin
Abstract
0
navinc80
6/8/2006 6:53:12 AM
asp.net.dotnetnuke-modules 4559 articles. 0 followers. Follow

0 Replies
488 Views

Similar Articles

[PageSpeed] 49

Reply:

Similar Artilces:

The type initializer for "Russell.Modules.CustomWear.DataAccessLayer.DataProvider" threw an exception
The type initializer for "Russell.Modules.CustomWear.DataAccessLayer.DataProvider" threw an exceptionHi I'm coverting one of my custom Modules to 3.1For this module i have three Modules (Just presentation layers) Using the same BLL and DAL in their own projects.Like everyone who seems to have this problem the error seems to be in my dataprovider classThe two assemblies that the three presentation modules use are:Russell.Modules.CustomWear.dll   andRussell.Modules.CustomWear.SqlDataProvider.dllThe namespace for both my dataprovider class and my sqldataprovider class is: Russell.Mod...

HelloWorld tutorial: The type initializer for "DotNetNuke.Data.DataProvider" threw an exception
Hello All,I've been struggling for the last few days trying to complete the HelloWorld module tutorial from dnnJungle using DNN 3.0.13 and Visual Studio 2002.  I think this would have all been much easier if I had VS2003 (time spent converting project files, solutions files, wizard files, fixing over 300 syntax errors, installing 1.1Framework, uninstalling 1.1Framework, re-installing 1.1Framework, etc.)Anyway, I'm at the last step of the tutorial which is creating the HelloWorldOptions.ascx page and now I've hit another glitch.  When I try to open the page in designer I g...

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD 9.0.0.580. Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

pulling out "a","an", "the" from beginning of strings
I need to pull out articles "a", "an", and "the" from the beginning of title strings so that they sort properly in MySQL. What is the best way to accomplish that if I have a single $scalar with the whole title in it? Thanks, Tim -- Tim McGeary tim.mcgeary@lehigh.edu --=-weUphL4mkB1WR5g+DMDc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, 2004-08-24 at 15:04, Tim McGeary wrote: > I need to pull out articles "a", "an", and "the" from the beginning of=20 >...

Type Initializer for "System.Net.IpAddress" threw an exception
Apologies - I posted this in the GD forum by mistake instead of here... .... System: Windows XP Professional The other day I had a perfect working copy of Web Matrix on which I am developing an MS SQL based package. Then,  two things happened. The first is that my Outlook 2000 Premium was reconfigured to collect and send mail via an Exchange Server as well as my normal POP3 based system.  The second is that a Blue Tooth mouse was installed. Now,  whenever I load a source file into WebMatrix and press the 'F5' key to launch the web server I get this error: "The Type...

Type Initializer for "System.Net.IpAddress" threw an exception
.... System: Windows XP Professional The other day I had a perfect working copy of Web Matrix on which I am developing an MS SQL based package. Then,  two things happened. The first is that my Outlook 2000 Premium was reconfigured to collect and send mail via an Exchange Server as well as my normal POP3 based system.  The second is that a Blue Tooth mouse was installed. Now,  whenever I load a source file into WebMatrix and press the 'F5' key to launch the web server I get this error: "The Type Initializer for 'System.Net.IpAddress' threw an exception" and the following...

quotes, quotes, quotes...
I am getting this error and I know what is causing it, but I have no idea how to fix it, any help would be great. The script steps through the /var/log/messages file on a linux server and puts The entries into a mysql database. However when it gets to the 'hlt' line in the messages file it just barfs. The single quotes are freaking it out. I know about quotes but not how to use in this situation. Thanks, Paul Error: May 27 17:53:00 localhost kernel: Checking 'hlt' instruction... OK. <----- doesn't like this in the messages file DBD::mysql::st exec...

Upgrade DNN 3.0.13 -> 3.1.0 error: The type initializer for "DotNetNuke.Data.DataProvider" threw an exception
I tested the upgrade on a test system and worked fine. But now I have published the code to upgrade the production site and receive this following error:  Server Error in '/' Application. Value cannot be null. Parameter name: type 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.ArgumentNullException: Value cannot be null. Parameter name: typeSource Error: An unhandled exception was generated during ...

The type initializer for "..." threw an exception.
I am creating a custom module. when i get this error when trying to connect to the SQL Database "The type initializer for "Custom.CustomModules.DataProvider" threw an exception. I read somewhere that this should be .SQLDataProvider.  Can any one help me with this. This is usually found when either your sql dataprovider is not on the bin folder or you named it differently than what is expected (given the name you used in your dataprovider.vb code). Thanks I have solved this problem but now I am getting "Cast from string "CustomList" to type 'Integer...

replace the "." with a ","
Oi.... I need to build a small programm in ASP.NET and chose to use C# for it.Now i got everything working but there's one little problem.the first textbox is a double. I need to make it so that when someone enters a "." then it gets replaced by a ","any ideas?Ghan  string blah = "4.2.2.2";blah = blah.Replace(".", ",");Ryan Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

"To" and "From" missing
When I print emails, the words "To" and "From" are blank, even though the "To" name and "From name (addresser, addressee) do show up. This is not a problem for other users on my system. Suggestions In mailbox right click, view. On the message window, right click and choose print options. Make sure print header is checked. -- Barry Merchant NSC Volunteer SysOp *** no email unless requested please!! *** > In mailbox right click, view. On the message window, right click and > choose print options. Make sure prin...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

System.TypeInitializationException: The type initializer for "Test.Form.DataProvider" threw an exception. --->
 Hi I am getting an exception  whenever I add a new function  or sub procedure  to   Data provider class in  a module development.  I am developing  a form module  its name as  Test.From.   The  exception  report follows   DotNetNuke.Services.Exceptions.ModuleLoadException: The type initializer for "Test.Form.DataProvider" threw an exception. ---> System.TypeInitializationException: The type initializer for "Test.Form.DataProvider" threw an exception. ---> System.ArgumentNullException: Value cannot be nul...

"Me" is better than "You"
Yes I know, strings are frozen. But let me talk about it, I really can't get through the idea of a PC talkin to me. I consider my PC as an extension of myself, not a dumb companion who addresses Me as You. Yes there are times when I get angry with Him while I work and get wrong calculations etc.., but it really is my fault, Me using wrong istructions and eventually wanting to find someone else to blame, but it's Me. And yes, I consider Thunderbird my mail program, reading my mail on my PC as Me. So I personally like to have Me in the header bar as a compact address ...

Web resources about - Regarding exception -Message "The type initializer for "eradllc.maindbtest.DataProvider" threw an exception." String - asp.net.dotnetnuke-modules

Resources last updated: 12/17/2015 4:10:47 PM