Welcome Guest Search | Active Topics | Log In | Register

can not fix this problem Options · View
thelma
#1 Posted : Wednesday, April 16, 2008 7:53:47 PM

Rank: YAF Forumling


Joined: 4/16/2008
Posts: 1
Location: Vietnam
Hi all

I have just installed succesfully a forum and worked in 3 hours very good.

But now I can not access my forum, the error message I had "There has been a serious error loading the forum. No futher information is available.Please contact the administrator if this message persists."

I try to view Event Log and saw the log is:


Object cannot be cast from DBNull to other types.
at System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider)
at System.Convert.ToDateTime(Object value)
at ASP.pages_forum_ascx.__DataBind__control10(Object sender, EventArgs e)
at System.Web.UI.Control.OnDataBinding(EventArgs e)
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem)
at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
at System.Web.UI.WebControls.Repeater.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at yaf.pages.forum.BindData()
at yaf.pages.forum.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Anyone can help me to exit this problem? Sad

Thanks too much...
Kristy11
#2 Posted : Thursday, April 17, 2008 4:29:07 AM

Rank: YAF Forumling


Joined: 4/17/2008
Posts: 7
Location: Brisbane
I too have this problem. Is there anyone who is able to help?

Thank you so much.
Jaben
#3 Posted : Thursday, April 17, 2008 4:51:35 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,045
Location: Honolulu, HI
fixed in new versions of the forum available here.
"When you are grateful, fear disappears and abundance appears”."

Aen Sidhe
#4 Posted : Thursday, April 17, 2008 10:11:15 AM

Rank: YAF Forumling


Joined: 4/12/2008
Posts: 3
Location: Lipetsk
I've encountered this issue in 1.9.1.8 today
Jaben
#5 Posted : Thursday, April 17, 2008 10:23:01 AM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,045
Location: Honolulu, HI
DO you guys have "moderated" forums?
"When you are grateful, fear disappears and abundance appears”."

Aen Sidhe
#6 Posted : Thursday, April 17, 2008 2:15:35 PM

Rank: YAF Forumling


Joined: 4/12/2008
Posts: 3
Location: Lipetsk
Yes.

Sorry, if I missed some FAQ, where this problem is described.
sparrow
#7 Posted : Friday, April 18, 2008 2:46:51 AM

Rank: YAF Forumling


Joined: 4/17/2008
Posts: 2
Location: RI
I think i have the same problem....

4/17/2008 2:48 PM in mscorlib
Object cannot be cast from DBNull to other types.
at System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider)
at System.Convert.ToDateTime(Object value)
at ASP.pages_forum_ascx.__DataBind__control10(Object sender, EventArgs e)
at System.Web.UI.Control.OnDataBinding(EventArgs e)
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem)
at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource)
at System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e)
at System.Web.UI.WebControls.Repeater.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at yaf.pages.forum.BindData()
at yaf.pages.forum.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

SirSparrow 4/17/2008 2:48:06 PM ASP.default_aspx

any help would be great!

~sparrow~
jacobm
#8 Posted : Friday, May 23, 2008 7:18:46 PM

Rank: YAF Forumling


Joined: 5/23/2008
Posts: 1
Location: Orlando, FL
I am also seeing this problem in version 1.9.1.8. Was there any resolution.

Source Error:


Line 74: </td>
Line 75: <td class="post" style="width: 25em; text-align: right;">
Line 76: <%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) ) )%>
Line 77: <a href="<%#yaf.Forum.GetLink(yaf.Pages.posts,"m={0}#{0}",DataBinder.Eval(Container.DataItem, "LastMessageID"Wink)%>">
Line 78: <img src="<%# GetThemeContents("ICONS","ICON_LATEST"Wink %>" border="0" alt=""></a>


Source File: c:\Inetpub\wwwroot\Website2004\Forum\pages\forum.ascx Line: 76

Stack Trace:


[InvalidCastException: Object cannot be cast from DBNull to other types.]
System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider) +54
System.Convert.ToDateTime(Object value) +29
ASP.pages_forum_ascx.__DataBind__control10(Object sender, EventArgs e) in c:\Inetpub\wwwroot\Website2004\Forum\pages\forum.ascx:76
System.Web.UI.Control.OnDataBinding(EventArgs e) +99
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +206
System.Web.UI.Control.DataBind() +12
System.Web.UI.Control.DataBindChildren() +216
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216
System.Web.UI.Control.DataBind() +12
System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +130
System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +454
System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53
System.Web.UI.WebControls.Repeater.DataBind() +72
System.Web.UI.Control.DataBindChildren() +216
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216
System.Web.UI.Control.DataBind() +12
System.Web.UI.Control.DataBindChildren() +216
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216
System.Web.UI.Control.DataBind() +12
yaf.pages.forum.BindData() +4197
yaf.pages.forum.Page_Load(Object sender, EventArgs e) +813
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


Jaben
#9 Posted : Friday, May 23, 2008 8:42:07 PM

Rank: YAF Head Dude



Joined: 10/10/2004
Posts: 3,045
Location: Honolulu, HI
try changing the line in forums.ascx to this (not tested):
Code:
<%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) == DBNull.Value ? DataBinder.Eval( Container.DataItem, "LastPosted" ) : DateTime.Now ) )%>


"When you are grateful, fear disappears and abundance appears”."

XeE
#10 Posted : Monday, May 26, 2008 4:16:03 PM
Rank: Advanced Member



Joined: 12/6/2007
Posts: 57
Location: pakistan
you get this error when you have null in LastPosted Column in the table. To overcome this problem, i have made solution for it.

Solution:

Open sp yaf_topic_save then replace the sp with the following.
Note: The addition in this stored procedure is LastPosted, if LastPosted is Null,replace it with current date time. I hope it will help you people as well who want to have some moderated forums.


Code:

CREATE PROCEDURE [dbo].[yaf_topic_save](
                @ForumID  INT,
                @Subject  NVARCHAR(128),
                @UserID   INT,
                @Message  NTEXT,
                @Priority SMALLINT,
                @UserName NVARCHAR(50)  = NULL,
                @IP       NVARCHAR(15),
                @PollID   INT  = NULL,
                @Posted   DATETIME  = NULL,
                @LastPosted   DATETIME  = NULL,
       @Flags    INT)
AS
    BEGIN
        DECLARE  @TopicID INT
        DECLARE  @MessageID INT
        IF @Posted IS NULL
        SET @Posted = Getdate()
        IF @LastPosted IS NULL
        SET @LastPosted = Getdate()
        INSERT INTO yaf_Topic
                   (ForumID,
                    Topic,
                    UserID,
                    Posted,
                    Views,
                    LastPosted,
                    Priority,
                    PollID,
                    UserName,
                    NumPosts)
        VALUES     (@ForumID,
                    @Subject,
                    @UserID,
                    @Posted,
                     0,
                    @LastPosted,
                    @Priority,
                    @PollID,
                    @UserName,
                    0)
        SET @TopicID = Scope_identity()
        EXEC yaf_message_save
             @TopicID ,
             @UserID ,
             @Message ,
             @UserName ,
             @IP ,
             @Posted ,
              NULL ,
             @Flags ,
             @MessageID OUTPUT
        SELECT TopicID = @TopicID,
               MessageID = @MessageID
    END
GO

Jimena Rojas
#11 Posted : Friday, October 10, 2008 8:33:58 PM

Rank: YAF Forumling


Joined: 10/10/2008
Posts: 2
Location: Washington, DC
Hi everyone,

I'm new here and I need to moderate the forum. I'm having the same troubles as above.

I'm a little confused with the solution. Does post #9 work? or 10? or both? or one or the other?

Also, Where are the files that we're supposed to be modifying? in Pages>Admin> i found a "forums.ascx" file but no code about "<%# FormatDateTimeTopic( Co..."

Then in Pages>Moderate I found "forum.ascx" (note no "s"Wink

I guess what I'm trying to say in my VERY longwinded way is that I need a little more "hand holding"

Thanks for reading. please please help!

all the best,
Jimena
ureyes84
#12 Posted : Wednesday, October 15, 2008 8:11:31 PM

Rank: YAF Forumling


Joined: 10/9/2008
Posts: 3
Location: San Antonio
Jaben wrote:
try changing the line in forums.ascx to this (not tested):
Code:
<%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) == DBNull.Value ? DataBinder.Eval( Container.DataItem, "LastPosted" ) : DateTime.Now ) )%>




Hey guys, I think the code mentioned above should be:

Code:

<%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) != DBNull.Value ? DataBinder.Eval( Container.DataItem, "LastPosted" ) : DateTime.Now ) )%>


Notice the operator != instead of ==
ureyes84
#13 Posted : Wednesday, October 15, 2008 8:15:59 PM

Rank: YAF Forumling


Joined: 10/9/2008
Posts: 3
Location: San Antonio
Jimena Rojas wrote:

I'm a little confused with the solution. Does post #9 work? or 10? or both? or one or the other?


Hey hola Smile ,

The code change in the ascx file fixes the problem and the stored procedure modification prevents it. So you might want to do both.

Code:

<%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) != DBNull.Value ? DataBinder.Eval( Container.DataItem, "LastPosted" ) : DateTime.Now ) )%>



Jimena Rojas wrote:

Also, Where are the files that we're supposed to be modifying? in Pages>Admin> i found a "forums.ascx" file but no code about "<%# FormatDateTimeTopic( Co..."





forums.ascx file is located in C:\Inetpub\wwwroot\Forums\pages
See line 76, col 25 Smile




Jimena Rojas
#14 Posted : Thursday, October 16, 2008 8:42:56 PM

Rank: YAF Forumling


Joined: 10/10/2008
Posts: 2
Location: Washington, DC
Thanks! I really appreciate it!

IT WORKS! Dood. you're the best!

Cheesy Grin
ericbourland
#15 Posted : Wednesday, January 07, 2009 2:37:58 PM
Rank: Advanced Member


Joined: 12/3/2008
Posts: 33
Location: Chicago
Hi. Just FYI: this solution just worked for me, just now, bringing my moderated forum back online.

Code:

<%# FormatDateTimeTopic( Convert.ToDateTime( DataBinder.Eval( Container.DataItem, "LastPosted" ) != DBNull.Value ? DataBinder.Eval( Container.DataItem, "LastPosted" ) : DateTime.Now ) )%>


The file is forums.ascx, located in the /pages/ folder.

Thanks again for this fix.

Peace.

Eric
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.3 RC2 | YAF © 2003-2008, Yet Another Forum.NET
This page was generated in 0.176 seconds.

SourceForge.net Logo Powered by ASP.NET v2.0 411ASP.NET