Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0dotnetnuke database connection error !dotnetnuke database connection error !
Previous
 
Next
New Post
8/28/2008 5:18 PM
 

Hello freinds

Error in Database Access :

"The type initializer for 'Replink.Modules.ReplinkAdvancedProductSearch.DataProvider' threw an exception."

 

Error happening in the following code :
return DataProvider.Instance().getSaveListNames(ModuleId, UserId);
 
Any idea why this error? is that something because of error in code ?
 
 
 
AdvancedProductSearchController.cs

public class AdvancedProductSearchController    //: ISearchable, IPortable
    {
        #region Constructors
        public AdvancedProductSearchController()
        {
        }
        #endregion

        public DataTable getSaveListNames(int ModuleId, string UserId)
        {
            return DataProvider.Instance().getSaveListNames(ModuleId, UserId);
        }

        public DataTable getProductIds(int ModuleId, string UserId, string SaveListName)
        {
            return DataProvider.Instance().getProductIds(ModuleId, UserId, SaveListName);
        }

        public int addSaveList(int ModuleId, string UserID, string SavelistName, string ProductIDs)
        {
            return DataProvider.Instance().addSaveList(ModuleId, UserID, SavelistName, ProductIDs);
        }

        public int appendSaveList(int ModuleId, string UserID, string SaveListName, string ProductIDs)
        {
            return DataProvider.Instance().appendSaveList(ModuleId, UserID, SaveListName, ProductIDs);
        }

        public int updateSaveList(int ModuleId, string UserID, string SaveListName, string ProductIDs)
        {
            return DataProvider.Instance().updateSaveList(ModuleId, UserID, SaveListName, ProductIDs);
        }

        public int deleteSaveList(int ModuleId, string UserID, string SaveListName)
        {
            return DataProvider.Instance().DeleteSaveList(ModuleId, UserID, SaveListName);
        }

    }
}

DataProvider.cs

public abstract DataTable getSaveListNames(int ModuleId, string Userid);
public abstract DataTable getProductIds(int ModuleId, string UserID, string SaveListName);
public abstract int addSaveList(int ModuleId, string UserID, string SavelistName, string ProductIDs);
public abstract int updateSaveList(int ModuleId, string UserID, string SaveListName, string ProductIDs);
public abstract int appendSaveList(int ModuleId, string UserID, string SaveListName, string ProductIDs);
public abstract int DeleteSaveList(int ModuleId, string UserID, string SaveListName);
 
 
SqlDataProvider.cs
 
public override DataTable getSaveListNames(int ModuleId, string UserID)
        {
            SqlParameter[] arParams = new SqlParameter[2];
            arParams[0] = new SqlParameter("@ModuleId", SqlDbType.VarChar);
            arParams[0].Value = ModuleId;
            arParams[0].Direction = ParameterDirection.Input;

            arParams[1] = new SqlParameter("@UserId", SqlDbType.VarChar);
            arParams[1].Value = UserID;
            arParams[1].Direction = ParameterDirection.Input;

            return (DataTable)SqlHelper.ExecuteDataset(ConnectionString, DatabaseOwner + ObjectQualifier + "sp_Rep_AdvPrdSrch_GetSaveListNames", arParams).Tables[0];
        }

        public override DataTable getProductIds(int ModuleId, string UserID, string SaveListName)
        {
            SqlParameter[] arParams = new SqlParameter[3];
            arParams[0] = new SqlParameter("@ModuleId", SqlDbType.VarChar);
            arParams[0].Value = ModuleId;
            arParams[0].Direction = ParameterDirection.Input;

            arParams[1] = new SqlParameter("@UserId", SqlDbType.VarChar);
            arParams[1].Value = UserID;
            arParams[1].Direction = ParameterDirection.Input;

            arParams[2] = new SqlParameter("@SaveListName", SqlDbType.VarChar);
            arParams[2].Value = SaveListName;
            arParams[2].Direction = ParameterDirection.Input;

            return (DataTable)SqlHelper.ExecuteDataset(ConnectionString, DatabaseOwner + ObjectQualifier + "sp_Rep_AdvPrdSrch_GetProductIDs", arParams).Tables[0];
        }

        public override int addSaveList(int ModuleId, string UserID, string SavelistName, string ProductIDs)
        {
            SqlParameter[] arParams = new SqlParameter[3];
            arParams[0] = new SqlParameter("@ModuleId", SqlDbType.VarChar);
            arParams[0].Value = ModuleId;
            arParams[0].Direction = ParameterDirection.Input;

            arParams[1] = new SqlParameter("@UserId", SqlDbType.VarChar);
            arParams[1].Value = UserID;
            arParams[1].Direction = ParameterDirection.Input;

            arParams[2] = new SqlParameter("@SaveListName", SqlDbType.VarChar);
            arParams[2].Value = SavelistName;
            arParams[2].Direction = ParameterDirection.Input;

            arParams[3] = new SqlParameter("@ProductIDs", SqlDbType.VarChar);
            arParams[3].Value = ProductIDs;
            arParams[3].Direction = ParameterDirection.Input;

            return (int)SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner + ObjectQualifier + "sp_Rep_AdvPrdSrch_AddNewSaveListName", arParams);
        }

        public override int updateSaveList(int ModuleId, string UserID, string SaveListName, string ProductIDs)
        {
            SqlParameter[] arParams = new SqlParameter[5];
            arParams[0] = new SqlParameter("@ModuleId", SqlDbType.VarChar);
            arParams[0].Value = ModuleId;
            arParams[0].Direction = ParameterDirection.Input;

            arParams[1] = new SqlParameter("@UserId", SqlDbType.VarChar);
            arParams[1].Value = UserID;
            arParams[1].Direction = ParameterDirection.Input;

            arParams[2] = new SqlParameter("@SaveListName", SqlDbType.VarChar);
            arParams[2].Value = SaveListName;
            arParams[2].Direction = ParameterDirection.Input;

            arParams[3] = new SqlParameter("@ProductIDs", SqlDbType.VarChar);
            arParams[3].Value = ProductIDs;
            arParams[3].Direction = ParameterDirection.Input;

            return (int)SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner + ObjectQualifier + "sp_Rep_AdvPrdSrch_UpdateSaveList", arParams);
        }

        public override int appendSaveList(int ModuleId, string UserID, string SaveListName, string ProductIDs)
        {
            SqlParameter[] arParams = new SqlParameter[5];
            arParams[0] = new SqlParameter("@ModuleId", SqlDbType.VarChar);
            arParams[0].Value = ModuleId;
            arParams[0].Direction = ParameterDirection.Input;

            arParams[1] = new SqlParameter("@UserId", SqlDbType.VarChar);
            arParams[1].Value = UserID;
            arParams[1].Direction = ParameterDirection.Input;

            arParams[2] = new SqlParameter("@SaveListName", SqlDbType.VarChar);
            arParams[2].Value = SaveListName;
            arParams[2].Direction = ParameterDirection.Input;

            arParams[3] = new SqlParameter("@ProductIDs", SqlDbType.VarChar);
            arParams[3].Value = ProductIDs;
            arParams[3].Direction = ParameterDirection.Input;

            return (int)SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner + ObjectQualifier + "sp_Rep_AdvPrdSrch_AppendSaveList", arParams);
        }

        public override int DeleteSaveList(int ModuleId, string UserID, string SaveListName)
        {
            SqlParameter[] arParams = new SqlParameter[3];
            arParams[0] = new SqlParameter("@ModuleId", SqlDbType.VarChar);
            arParams[0].Value = ModuleId;
            arParams[0].Direction = ParameterDirection.Input;

            arParams[1] = new SqlParameter("@UserId", SqlDbType.VarChar);
            arParams[1].Value = UserID;
            arParams[1].Direction = ParameterDirection.Input;

            arParams[2] = new SqlParameter("@SaveListName", SqlDbType.VarChar);
            arParams[2].Value = SaveListName;
            arParams[2].Direction = ParameterDirection.Input;

            return (int)SqlHelper.ExecuteNonQuery(ConnectionString, DatabaseOwner + ObjectQualifier + "sp_Rep_AdvPrdSrch_DeleteSaveList", arParams);
        }

 

Any idea of why this error ?

thank you............

 
New Post
8/29/2008 10:02 AM
 

Hello,

the problem fixed by following the below instructions :

Source : http://www.ventrian.com/Support/ProductForums/tabid/118/view/topic/postid/6132/Default.aspx

1)  Make sure that both the sqlDataProvider class and the DataProvider class are in the same namespace.
2)  Verify those namespaces using the object browser in visual studio
3)  Verify that the solution outputs the dlls for both the module and data provider projects to the dotNetNuke bin directory
4)  the CreateObject call in the dataProvider class should be as follows:

CreateObject("data", "<NAMESPACE OF DATAPROVIDERS>", "<NAME OF MODULE DLL>", DataProvider)

Where the following explainations apply:

<NAMESPACE OF DATAPROVIDERS> = The namespace of the dataprovider class in the module project and the namespace of the sqldataprovider class in the dataProvider project (they should be in the same namespace).

<NAME OF MODULE DLL> = This is the name of the module dll that should be compiled into the dotNetNuke bin directory when the project is built (minus the ".dll" extension).

thank you........

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0dotnetnuke database connection error !dotnetnuke database connection error !


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out