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............