Hi, i'm Emiliano from Rome Italy and i'm trying to build a module to manage video on my website but when i try to use the dataprovider.cs to connect with the data i get the error below:
System.ArgumentNullException: Value cannot be null.
Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName) at Blekke.PlayVideo.DataProvider.CreateProvider() in C:\inetpub\wwwroot\playvideo\DesktopModules\Blekke.PlayVideo\App_Code\DataProvider.cs:line 55 at Blekke.PlayVideo.DataProvider..cctor() in C:\inetpub\wwwroot\playvideo\DesktopModules\Blekke.PlayVideo\App_Code\DataProvider.cs:line 49 - The type initializer for 'Blekke.PlayVideo.DataProvider' threw an exception.
the error is throw on the instruction :
objProvider = (DataProvider)Reflection.CreateObject("data", "Blekke.PlayVideo", "Blekke.PlayVideo.SqlDataProvider,Blekke.PlayVideo");
where the parameter means (or i would they means):
"data": ObjectProviderType
"Blekke.PlayVideo": ObjectNameSpaces
"Blekke.PlayVideo.SqlDataProvider,Blekke.PlayVideo": ObjectAssemblyName
Now, i've understand that the problem is a null value passed to the System.Activator.CreateInstance() but i can't understand what is the parameter.
Below the complete code of my dataprovider.cs
using System;
using System.Data;
using DotNetNuke;
using DotNetNuke.Framework;
namespace Blekke.PlayVideo
{
public abstract class DataProvider
{
private static DataProvider objProvider = null;
static DataProvider()
{
CreateProvider();
}
private static void CreateProvider()
{
objProvider = (DataProvider)Reflection.CreateObject("data", "Blekke.PlayVideo", "Blekke.PlayVideo.SqlDataProvider,Blekke.PlayVideo");
}
public static DataProvider Instance()
{
return objProvider;
}
public abstract void AddPlayVideo(int ModuleId, string Content, int UserId);
public abstract IDataReader GetPlayVideo(int ModuleId, int ItemId);
public abstract IDataReader GetPlayVideos(int ModuleId);
public abstract void UpdatePlayVideo(int ModuleId, int ItemId, string Content, int UserId);
public abstract void DeletePlayVideo(int ModuleId, int ItemId);
public abstract void PlayVideo_Serie_Insert(String Serie, String Icona);
public abstract void PlayVideo_Categorie_Insert(String Descrizione, String Icona);
public abstract void PlayVideo_SottoCategorie_Insert(String Descrizione, int IdCategoria, String Icona);
public abstract void PlayVideo_Video_Insert(Int32 sc, Int32 s, String nv, String tv, String dv, Int32 c, String vp, String t, String a, String d);
public abstract IDataReader PlayVideo_Serie_Select(String Serie);
public abstract IDataReader PlayVideo_Categorie_Select(String Descrizione);
public abstract IDataReader PlayVideo_SottoCategorie_Select(Int32 IdCategoria, String Descrizione);
public abstract IDataReader PlayVideo_Video_Select(Int32 v, String t, Int32 c, Int32 sc, Int32 s, String a, Int32 u);
}
}
I hope you can help me.
Thanks Emiliano