Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 14th, 2008, 04:25 AM
Registered User
Join Date: May 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to belmin45 Send a message via Yahoo to belmin45
Default Name 'CAM' is not declared.

can you helped me in this code...i am only a beginner of asp.net but seems it always like this.i buy two books of wrox but the sample is always not compiling..

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30451: Name 'CAM' is not declared.

Source Error:

Line 92: <asp:TemplateColumn SortExpression="Author" HeaderText="Author">
Line 93: <ItemTemplate>
Line 94: <asp:Label id="Label1" runat="server"> <%# CAM.Formatting.MyCstr(Container.DataItem("Author") , True, False) %> </asp:Label>
Line 95: </ItemTemplate>
Line 96: </asp:TemplateColumn>

Source File: C:\Inetpub\wwwroot\GuestbookKO\NewFile.aspx Line: 94
this is the main code:

<%@ Page Language="VB" Debug="true" %>
<%@ Register TagPrefix="CAM" TagName="Menu" Src="header.ascx" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">

    Sub Page_Load(Sender As Object, E As EventArgs)

        If Not Page.IsPostBack Then

            ' Databind the data grid on the first request only
            ' (on postback, rebind only in paging and sorting commands)


        End If

    End Sub

    Property SortField() As String

            Dim o As Object = ViewState("SortField")
            If o Is Nothing Then
                Return String.Empty
            End If
            Return CStr(o)
        End Get

        Set(ByVal Value As String)
            ViewState("SortField") = Value
        End Set

    End Property
      Sub DataGrid_Page(Sender As Object, e As DataGridPageChangedEventArgs)

            DataGrid1.CurrentPageIndex = e.NewPageIndex

        End Sub

        Sub DataGrid_Sort(Sender As Object, e As DataGridSortCommandEventArgs)

            DataGrid1.CurrentPageIndex = 0
            SortField = e.SortExpression

        End Sub

    Sub BindGrid()

        Dim CommandText As String

        ' TODO: update the CommandText value for your application
        If SortField = String.Empty Then
            CommandText = "select Author, Subject, Message, PostedDate from GuestBookEntries order by PostedDate desc"
            CommandText = "select Author, Subject, Message, PostedDate from GuestBookEntries order by " & SortField
        End If

        Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("C AM"))
        Dim myCommand As New SqlDataAdapter(CommandText, myConnection)

        Dim ds As New DataSet()

        DataGrid1.DataSource = ds

    End Sub

<body style="FONT-FAMILY: arial">
        <CAM:Menu id="Menu" title="Guest Book" runat="server"></CAM:Menu>

    <form runat="server">
        <asp:datagrid id="DataGrid1" runat="server" OnSortCommand="DataGrid_Sort" OnPageIndexChanged="DataGrid_Page" width="80%" AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" PageSize="6" ForeColor="Black" BackColor="White" CellPadding="3" GridLines="None" CellSpacing="1">
            <HeaderStyle font-bold="True" forecolor="White" backcolor="#4A3C8C"></HeaderStyle>
            <PagerStyle horizontalalign="Right" backcolor="#C6C3C6" mode="NumericPages"></PagerStyle>
            <ItemStyle backcolor="#DEDFDE"></ItemStyle>
                <asp:TemplateColumn SortExpression="Author" HeaderText="Author">
                        <asp:Label id="Label1" runat="server"> <%# CAM.Formatting.MyCstr(Container.DataItem("Author") , True, False) %> </asp:Label>

Old May 27th, 2008, 01:56 AM
Authorized User
Join Date: Sep 2006
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts

Web Config may be missing the entry for this control . Need to add the contol in control tag in web config.

Check It out
Old May 27th, 2008, 02:13 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

I don't think this has to do with existing examples from books, but with your own code. Take a look at this:


Where is CAM defined? Where is Formatting defined? What makes you believe this should work? I don't see any other reference to Formatting than the one in the code generating an error.

If you explain a bit more about your code / setup, maybe we can offer something useful.



Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp.net, with VB, Web-cam used in website max_sp07 Pro VB 6 2 August 25th, 2008 06:59 AM
BC30451: Name 'My' is not declared abc052107 Visual Studio 2005 0 July 2nd, 2007 11:01 PM
web cam code hutang4real Classic ASP Basics 1 March 28th, 2007 02:25 PM
Accessing a Web Cam Figgis Visual Basic 2005 Basics 0 April 28th, 2006 03:43 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.