locked
Broken Events RRS feed

  • Question

  • User-957717987 posted

    While trying to delete a test event I created, I seem to have broken my Events Section. Here is the Error. Any help would be appreciated

     

    Server Error in '/' Application.

    Unable to cast object of type 'System.DBNull' to type 'System.String'.

    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.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.

    Source Error:

    The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

    1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

      <%@ Page Language="C#" Debug="true" %>

    or:

    2) Add the following section to the configuration file of your application:

    <configuration>
       <system.web>
           <compilation debug="true"/>
       </system.web>
    </configuration>

    Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

    Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

    Stack Trace:

    [InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.]
       ASP.events_calendar_aspx.__DataBinding__control7(Object sender, EventArgs e) +263
       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
       ControlSample.EventCalendar.CreateDataBoundChildren(DataView dv, Table table, DateTime todaysDate, DateTime visibleDate, Calendar threadCalendar) +657
       ControlSample.EventCalendar.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +222
       System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59
       System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111
       System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29
       System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
       System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
       System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
       System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
       System.Web.UI.Control.EnsureChildControls() +87
       System.Web.UI.Control.PreRenderRecursiveInternal() +41
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Control.PreRenderRecursiveInternal() +161
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210

     

    Dale L<!-- [InvalidCastException]: Unable to cast object of type 'System.DBNull' to type 'System.String'. at ASP.events_calendar_aspx.__DataBinding__control7(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 ControlSample.EventCalendar.CreateDataBoundChildren(DataView dv, Table table, DateTime todaysDate, DateTime visibleDate, Calendar threadCalendar) at ControlSample.EventCalendar.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.events_calendar_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) --><!-- This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->

    Monday, February 5, 2007 7:30 PM

Answers

  • User942311321 posted

    I've never used goDaddy, but how did you get the record you posted earlier? Through the browser? You might be able to delete it in there.

    Otherwise, you need to get the ip of the database. This would be provided to you somewhere. Open Visual Studio, in the menu bar at the top click: 'View', then  'Database Explorer'. You will see the plane on the side that appears, if it isnt there already. Right click on 'Data Connections', and add the sql server ip. Set it to use Server Authentication and enter your username and password.Then select the 'Club' database. Expand the 'Club' database and choose the 'Tables' folder. Right click the 'Events' table and choose 'Show Table Data'. The data will then be displayed, Right click the very left-end about the * and choose delete row.

    If you can add a query, use: 

    DELETE FROM Events WHERE id='1' 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 5, 2007 8:44 PM

All replies

  • User942311321 posted
    It seems you have a null value when it expects a value. Search the database for the event you entered and enter a value and see if it works. (Make sure the value you entered is of same type for the column)
    Monday, February 5, 2007 7:50 PM
  • User-957717987 posted

    This is what I ran:

     SELECT id, starttime, endtime, title, description, staticURL, location, photo, album FROM Events WHERE title='TEST'

     This is what I got (spacing is my own to try to add clarity)

    id starttime endtime title description staticURL location photo album
    1 2/5/2007 4:57:00 PM 2/5/2007 7:57:00 PM TEST (NULL) (NULL) (NULL) 0 (NULL)
    1 record(s) affected.

     

    I'm afraid that I still don't get how to fix this.

    Is there anyway that I can just delete that record from that table so that it could be like this never happened?

    Monday, February 5, 2007 8:15 PM
  • User942311321 posted
    Yea, bingo. Delete that record and it will work again.
    Monday, February 5, 2007 8:16 PM
  • User-957717987 posted

    Ok, please forgive my ignorance, how do I do that? the club site is hosted on GoDaddy and it seems like the only way to interract with the DB is to use their online tools... So is there some statement can pass to the Query Analyser?

    I have about 4 hours experience with SQL, .NET, and none at all with any programming language. But in a refreshing twist for a new guy I am trying to learn by jumping in completely over my head ;-)

    Thanks again,

     

    Dale

    Monday, February 5, 2007 8:29 PM
  • User942311321 posted

    I've never used goDaddy, but how did you get the record you posted earlier? Through the browser? You might be able to delete it in there.

    Otherwise, you need to get the ip of the database. This would be provided to you somewhere. Open Visual Studio, in the menu bar at the top click: 'View', then  'Database Explorer'. You will see the plane on the side that appears, if it isnt there already. Right click on 'Data Connections', and add the sql server ip. Set it to use Server Authentication and enter your username and password.Then select the 'Club' database. Expand the 'Club' database and choose the 'Tables' folder. Right click the 'Events' table and choose 'Show Table Data'. The data will then be displayed, Right click the very left-end about the * and choose delete row.

    If you can add a query, use: 

    DELETE FROM Events WHERE id='1' 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 5, 2007 8:44 PM
  • User-957717987 posted

    Was able to run the query you gave me and it worked wonders.... whew... going to go get a cold beer and try this again later....

     

    thanks all for the help!

    Monday, February 5, 2007 9:07 PM
  • User523970105 posted

    Ok, please forgive my ignorance, how do I do that? the club site is hosted on GoDaddy and it seems like the only way to interract with the DB is to use their online tools... So is there some statement can pass to the Query Analyser?

    I have about 4 hours experience with SQL, .NET, and none at all with any programming language. But in a refreshing twist for a new guy I am trying to learn by jumping in completely over my head ;-)

    Thanks again,

     

    Dale

    The GoDaddy MSSQL control panel (the same place that you found the query analyzer) allows you to examine and modify the structure and content of any of the tables in the database using a fairly straightforward graphical user interface.  Start by clicking the "+" next to your database name, then drill down into your tables.  You have to be a bit careful, because there isn't an "undo" button.  You can perform inserts, edits, and deletes using the GUI.

     

    Tuesday, February 6, 2007 1:17 PM