Results 1 to 12 of 12

Thread: Compiler Error Message BC30456

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Compiler Error Message BC30456

    Hey all. I am working on publishing a website called www.politicalpunk.org. One of the features I want to incorporate into my project is user comments and also a repeating table on my default page for top headlines.

    Instead of creating an entirely new database I have been working on integrating this project http://msdn.microsoft.com/msdnmag/is...efault.aspx#S3 as a means to post user comments and also to use the repeating table template. I know this project is more than what I am looking for, but I am trimming where I see fit.

    After adding his database and his App_Code and his web.config I tired to load the page where i get the error line'comment_editcommand' is not a member of default.aspx

    Anyone know why I am getting this exception? I get three erors all like this, but the others are 'comment_createcommand' and something else. I am unable to get the page to load. ANy help or do you all need more details? Is this an error that is possibly in the .vb file? I have heard talk of the problem being in the back code and having something to do with event handlers, but PLEASE I need some help!

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Compiler Error Message BC30456

    Welcome to the Forums.

    Moved
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Re: Compiler Error Message BC30456

    Let me offer a little more information. The original project loads fine, but when I use my project to load it I get my errors. This is the piece of code i pasted into my source to get the repeating table effect for my front page and comments:

    <asp:repeater id="Blog" Runat="server">
    <HeaderTemplate>
    <table width="100%" border="1" cellpadding="0" cellspacing="0"><tr><td>
    </HeaderTemplate>
    <ItemTemplate>
    <asp:Literal Runat="server" ID="DayBox">
    </td></tr></table><div align="right"><a href="#TopPage">Top</a></div><br>
    <table width="100%" border="1" cellpadding="0" cellspacing="0"><tr><td>
    </asp:Literal>
    <asp:Panel Runat="server" ID="DayTitle">
    <h3><%# DataBinder.Eval(Container.DataItem, "AddedDate", "{0:dddd, MMMM dd}") %></h3>
    </asp:Panel>

    <p align="justify">
    <b><%# Container.DataItem("Title") %></b>
    @ <%# DataBinder.Eval(Container.DataItem, "AddedDate", "{0:hh:mm tt}") %>
    &nbsp;
    <asp:LinkButton CausesValidation="False" runat="server" Text="Edit" CommandName="Edit"
    CommandArgument='<%# Container.DataItem("MessageID") %>'
    Visible='<%# User.Identity.IsAuthenticated %>'/>
    &nbsp;
    <asp:LinkButton CausesValidation="False" runat="server" ID="DeleteMessage" Text="Delete" CommandName="Delete"
    CommandArgument='<%# Container.DataItem("MessageID") %>'
    Visible='<%# User.Identity.IsAuthenticated %>'/>
    <br>
    <%# Container.DataItem("Message") %>
    <br>
    -- <%# Container.DataItem("CommentsCount") %>
    comments:
    <asp:HyperLink Runat="server" Visible='<%# Container.DataItem("CommentsCount") > 0 %>'
    NavigateUrl='<%# "javascript:ToggleDivState(div" & Container.DataItem("MessageID") & ");" %>'>View</asp:HyperLink>
    - <a href='<%# "javascript:ShowCommentBox(" & Container.DataItem("MessageID") & ");" %>'>
    Post your own comment</a>
    <div style="display:none; margin-left:2.0em; margin-top:.8em; " ID='<%# "div" & Container.DataItem("MessageID") %>'>
    <aspataList Runat="server" Width="500px" ItemStyle-BackColor="whitesmoke" AlternatingItemStyle-BackColor="white"
    DataSource='<%# Container.DataItem.Row.GetChildRows("MsgComments") %>'
    OnDeleteCommand="Comments_DeleteCommand" OnItemCreated="Comments_ItemCreated" OnEditCommand="Comments_EditCommand">
    <ItemTemplate>
    <p align="justify">
    <u>Posted by <a class="comment" href='<%# "mailto:" & Container.DataItem("Email") %>'><%# Container.DataItem("Author") %></a></b>
    @ <%# CType(Container.DataItem("AddedDate"), Date).ToString("hh:mm tt, MMMM dd") %>
    </u>
    &nbsp;
    <asp:LinkButton CausesValidation="False"
    runat="server" Text="Edit" CommandName="Edit"
    CommandArgument='<%# Container.DataItem("CommentID") %>'
    Visible='<%# User.Identity.IsAuthenticated %>'/>
    &nbsp;
    <asp:LinkButton CausesValidation="False" runat="server" CommandName="Delete"
    ID="DeleteComment" Text="Delete" CommandArgument='<%# Container.DataItem("CommentID") %>'
    Visible='<%# User.Identity.IsAuthenticated %>'/>
    <br>
    <%# Container.DataItem("Comment") %>
    </p>
    </ItemTemplate>
    <SeparatorTemplate><br></SeparatorTemplate>
    </aspataList>
    </div>
    </p>
    </ItemTemplate>
    <FooterTemplate>
    </td></tr></table><div align="right"><a href="#TopPage">Top</a></div><br>
    </FooterTemplate>
    </asp:repeater>

    If I need to post the back code let me know I can do that too.

  4. #4
    Addicted Member
    Join Date
    Dec 2004
    Posts
    143

    Re: Compiler Error Message BC30456

    Check your code behind.

    You say that comment_editcommand is causing a problem but you actually specify comments_editcommand in the datagrid aspx declaration.
    Do you have a a method called this? Or should it actually be Comments_editcommand?

    Make sure all your methods in the code behind match up to what you have specified in the aspx page.

    F

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Re: Compiler Error Message BC30456

    Quote Originally Posted by Ferris
    Check your code behind.

    You say that comment_editcommand is causing a problem but you actually specify comments_editcommand in the datagrid aspx declaration.
    Do you have a a method called this? Or should it actually be Comments_editcommand?

    Make sure all your methods in the code behind match up to what you have specified in the aspx page.

    F
    yes 'comments_editcommand' is not a member of .aspx is the error I get. I also get the other two errors that are located in the same code line as 'comments_editcommand' is not a member of .aspx

    These are the 3 errors I get:
    OnDeleteCommand="Comments_DeleteCommand" OnItemCreated="Comments_ItemCreated" OnEditCommand="Comments_EditCommand">
    Last edited by politicalmike; Apr 5th, 2007 at 08:08 AM.

  6. #6
    Addicted Member
    Join Date
    Dec 2004
    Posts
    143

    Re: Compiler Error Message BC30456

    Can you please post your code?

    F

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Re: Compiler Error Message BC30456

    Imports System.Data.SqlClient
    Imports System.Data.OleDb
    Imports System.Configuration
    Imports System.Web.Mail

    Namespace VB2TheMax.WebLogger.Business
    Public Class Blog
    Private m_Connection As OleDbConnection
    Private m_brChar As String = Convert.ToChar(13) & Convert.ToChar(10)

    Public Sub New()
    m_Connection = New OleDbConnection(ConfigurationManager.AppSettings("Blog_ConnString"))
    End Sub

    Private Sub ExecuteCommand(ByVal cmd As OleDbCommand)
    cmd.Connection = m_Connection
    Try
    m_Connection.Open()
    cmd.ExecuteNonQuery()
    Finally
    m_Connection.Close()
    End Try
    End Sub

    ' Get the messages/comments for the specified interval
    Public Function GetData(ByVal fromDate As Date, ByVal toDate As Date) As DataSet
    Dim ds As New DataSet()
    ' fill the dataset's Messages table with the messages posted in the specified interval
    Dim da As New OleDbDataAdapter("SELECT * FROM Blog_Messages WHERE AddedDate BETWEEN ? AND ? ORDER BY AddedDate DESC", m_Connection)
    da.SelectCommand.Parameters.Add("FromDate", OleDbType.Date).Value = fromDate
    da.SelectCommand.Parameters.Add("ToDate", OleDbType.Date).Value = toDate.AddDays(1)
    m_Connection.Open()
    da.Fill(ds, "Messages")

    ' fill the dataset's Comments table with the comments for the loaded messages
    If ds.Tables("Messages").Rows.Count > 0 Then
    Dim inFilter As String = ""
    ' get a comma-delimited list of the IDs of the retrieved messages
    Dim dr As DataRow
    For Each dr In ds.Tables("Messages").Rows
    If inFilter = "" Then
    inFilter = dr("MessageID")
    Else
    inFilter &= ", " & dr("MessageID")
    End If
    Next
    ' build the SELECT for the Comments table
    da.SelectCommand.CommandText = "SELECT * FROM Blog_Comments WHERE MessageID IN (" & _
    inFilter & ") ORDER BY AddedDate DESC"
    Else
    da.SelectCommand.CommandText = "SELECT * FROM Blog_Comments WHERE MessageID = -1"
    End If
    da.Fill(ds, "Comments")
    m_Connection.Close()

    ' if the Comments table is empty, add a fake comment with ID = -1
    ' this is necessary to have the calculated column added next working fine
    If ds.Tables("Comments").Rows.Count = 0 Then
    Dim dr As DataRow = ds.Tables("Comments").NewRow()
    dr("CommentID") = -1
    dr("Author") = "none"
    dr("Email") = "none"
    dr("Comment") = "none"
    dr("AddedDate") = Date.Today
    ds.Tables("Comments").Rows.Add(dr)
    dr.AcceptChanges()
    End If

    ' create a parent/child relationship between the two tables, against the MessageID column
    ds.Relations.Add(New DataRelation("MsgComments", _
    ds.Tables("Messages").Columns("MessageID"), _
    ds.Tables("Comments").Columns("MessageID")))
    ' add a new calculated column to the Messages table, with the number of child comments
    ds.Tables("Messages").Columns.Add("CommentsCount", _
    GetType(Integer), "Count(Child(MsgComments).CommentID)")

    Return ds
    End Function

    ' Insert a new message
    Public Function InsertMessage(ByVal title As String, ByVal message As String)
    Dim cmd As New OleDbCommand("INSERT INTO Blog_Messages (Title, Message) VALUES (?, ?)")
    cmd.Parameters.Add("Title", OleDbType.VarChar).Value = title
    cmd.Parameters.Add("Message", OleDbType.LongVarChar).Value = message.Replace(m_brChar, "<br>")
    ExecuteCommand(cmd)
    End Function

    ' Insert a new comment
    Public Function InsertComment(ByVal messageID As Integer, ByVal author As String, ByVal email As String, ByVal comment As String)
    Dim cmd As New OleDbCommand("INSERT INTO Blog_Comments (MessageID, Author, Email, Comment) VALUES (?, ?, ?, ?)")
    cmd.Parameters.Add("MessageID", OleDbType.Integer).Value = messageID
    cmd.Parameters.Add("Author", OleDbType.VarChar).Value = HttpUtility.HtmlEncode(author)
    cmd.Parameters.Add("Email", OleDbType.VarChar).Value = HttpUtility.HtmlEncode(email)
    cmd.Parameters.Add("Comment", OleDbType.LongVarChar).Value = HttpUtility.HtmlEncode(comment).Replace(m_brChar, "<br>")
    ExecuteCommand(cmd)

    ' send the notification e-mail, if the setting is on
    Dim sendNotifications As String = ConfigurationSettings.AppSettings("Blog_SendNotifications")
    If Not sendNotifications Is Nothing AndAlso sendNotifications = "1" Then
    Dim msgTitle, msgDate As String
    ' read a few details of the parent message
    cmd.CommandText = "SELECT Title, AddedDate FROM Blog_Messages WHERE MessageID = " & messageID
    m_Connection.Open()
    Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
    If reader.Read Then
    msgTitle = reader("Title")
    msgDate = CType(reader("AddedDate"), Date).ToString("hh:mm tt on dddd, MMMM dd")
    reader.Close()
    End If

    ' build the msg's content
    Dim msg As String = String.Format( _
    "{0} (email: {1}) has just posted a comment the message ""{2}"" " & _
    "of your BLOG that you posted at {3}. Here's the comment:{4}{4}{5}", _
    author, email, msgTitle, msgDate, Environment.NewLine, comment)
    ' send the mail
    System.Web.Mail.SmtpMail.Send("WebLogger", _
    ConfigurationSettings.AppSettings("Blog_AdminEmail"), _
    "New comment notification", msg)
    End If
    End Function

    ' Update a message
    Public Function UpdateMessage(ByVal messageID As Integer, ByVal title As String, ByVal message As String)
    Dim cmd As New OleDbCommand("UPDATE Blog_Messages SET Title = ?, Message = ? WHERE MessageID = ?")
    cmd.Parameters.Add("Title", OleDbType.VarChar).Value = title
    cmd.Parameters.Add("Message", OleDbType.LongVarChar).Value = message.Replace(m_brChar, "<br>")
    cmd.Parameters.Add("MessageID", OleDbType.Integer).Value = messageID
    ExecuteCommand(cmd)
    End Function

    ' Update a comment
    Public Function UpdateComment(ByVal commentID As Integer, ByVal author As String, ByVal email As String, ByVal comment As String)
    Dim cmd As New OleDbCommand("UPDATE Blog_Comments SET Author = ?, Email = ?, Comment = ? WHERE CommentID = ?")
    cmd.Parameters.Add("Author", OleDbType.VarChar).Value = author
    cmd.Parameters.Add("Email", OleDbType.VarChar).Value = email
    cmd.Parameters.Add("Comment", OleDbType.LongVarChar).Value = comment.Replace(m_brChar, "<br>")
    cmd.Parameters.Add("CommentID", OleDbType.Integer).Value = commentID
    ExecuteCommand(cmd)
    End Function

    ' Delete a message
    Public Function DeleteMessage(ByVal messageID As Integer)
    Dim cmd As New OleDbCommand("DELETE FROM Blog_Messages WHERE MessageID = " & messageID)
    ExecuteCommand(cmd)
    End Function

    ' Delete a comment
    Public Function DeleteComment(ByVal commentID As Integer)
    Dim cmd As New OleDbCommand("DELETE FROM Blog_Comments WHERE CommentID = " & commentID)
    ExecuteCommand(cmd)
    End Function

    ' Return the data for a single message
    Public Sub GetMessageData(ByVal messageID As Integer, ByRef title As String, ByRef message As String)
    Dim cmd As New OleDbCommand("SELECT * FROM Blog_Messages WHERE MessageID = " & messageID, m_Connection)
    Try
    m_Connection.Open()
    Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
    If reader.Read Then
    title = reader("Title")
    message = reader("Message")
    reader.Close()
    End If
    Finally
    m_Connection.Close()
    End Try
    End Sub

    ' Return the data for a single comment
    Public Sub GetCommentData(ByVal commentID As Integer, ByRef author As String, ByRef email As String, ByRef comment As String)
    Dim cmd As New OleDbCommand("SELECT * FROM Blog_Comments WHERE CommentID = " & commentID, m_Connection)
    Try
    m_Connection.Open()
    Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
    If reader.Read Then
    author = reader("Author")
    email = reader("Email")
    comment = reader("Comment")
    reader.Close()
    End If
    Finally
    m_Connection.Close()
    End Try
    End Sub
    End Class
    End Namespace
    Cool?

  8. #8
    Addicted Member
    Join Date
    Dec 2004
    Posts
    143

    Re: Compiler Error Message BC30456

    If this is your entire code behind page then you are missing these 3 functions:

    Code:
    sub Comments_DeleteCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
    End Sub
    
    Sub Comments_ItemCreated (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
    End Sub
    
    Sub Comments_EditCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
    End Sub
    My guess is that since you weren't expecting them you can remove OnDeleteCommand="Comments_DeleteCommand" OnItemCreated="Comments_ItemCreated" OnEditCommand="Comments_EditCommand" from your datalist aspx declaration and don't bother putting the subs in to your code behind.
    Or simply include the above functions in your code behind.

    The choice is yours...

    F

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Compiler Error Message BC30456

    What version of ASP.NET? Does your web server support it? Did you create a virtual directory before uploading?

  10. #10

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Re: Compiler Error Message BC30456

    Quote Originally Posted by mendhak
    What version of ASP.NET? Does your web server support it? Did you create a virtual directory before uploading?
    Using ASP.net 2.0. We are still testing the website and have not uploaded it yet.

    We tried as Ferris said and added those pieces in the back code and also tried deleting them in the .aspx. My partner on the project is a network admin and is quite fluid in VB and MS SQl and so forth so it's not like we are going in blind.

    He added the sub parts from Ferris, nothing. We deleted that line of code from the .aspx document and now the website will load, but the table repeater will not show up on the actual website, but still does in design mode. Would the table repeater not show up until I had loaded the project to my server?

  11. #11

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    7

    Re: Compiler Error Message BC30456

    Quote Originally Posted by Ferris
    If this is your entire code behind page then you are missing these 3 functions:

    Code:
    sub Comments_DeleteCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
    End Sub
    
    Sub Comments_ItemCreated (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
    End Sub
    
    Sub Comments_EditCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs)
    End Sub
    My guess is that since you weren't expecting them you can remove OnDeleteCommand="Comments_DeleteCommand" OnItemCreated="Comments_ItemCreated" OnEditCommand="Comments_EditCommand" from your datalist aspx declaration and don't bother putting the subs in to your code behind.
    Or simply include the above functions in your code behind.

    The choice is yours...

    F

    Ferris we added that prior to your suggestion and no luck. If we delete that line from .aspx we can load the project, but see no instance of our repeating tables when we view the project.

  12. #12
    Addicted Member
    Join Date
    Dec 2004
    Posts
    143

    Re: Compiler Error Message BC30456

    Quote Originally Posted by politicalmike
    Ferris we added that prior to your suggestion and no luck. If we delete that line from .aspx we can load the project, but see no instance of our repeating tables when we view the project.
    Well at least it doesn't error any more.

    Maybe there is something else that is causing the tables not to show.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width