Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

The directive is missing a 'src' attribute

Posted on 2006-05-28
6
Medium Priority
?
1,396 Views
Last Modified: 2010-04-23
Hi,

Can someone explain to me how to resolve a Parser Error.  I'm a student try learning how to created a shopping cart for a school project.  Everything seems to working accept for this error:

Parser Error  (Line 2)
Parser Error Message: The directive is missing a 'src' attribute.
Source Error:
Line 1:  <%@ Control Language="vb" AutoEventWireup="false" Codebehind="uc_shopping_cart.ascx.vb" Inherits="BajaSalsa.uc_shopping" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
Line 2:  <%@Register TagPrefix="uc1" TagName="un_shopping_cart" Scr="uc_shopping_cart.ascx" %>
Line 3:  <TABLE id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0">
Line 4:        <TR>

Here is a copy of the Gobal.asax

Imports System.Web
Imports System.Web.SessionState

Public Class Global
    Inherits System.Web.HttpApplication

#Region " Component Designer Generated Code "

    Public Sub New()        'I tired to change area to Public Sub Global--did not work'
        MyBase.New()



        'This call is required by the Component Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Required by the Component Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Component Designer
    'It can be modified using the Component Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container
    End Sub

#End Region

    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started
    End Sub

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session is started
        Dim UserCart As New CShoppingCart
        Try
            ' Fires when the session is started
            Session("DBCon") = DBCon()
            Session("UserCart") = UserCart
            Session("Customer") = 1
        Catch ex As System.Exception
        Finally

        End Try
    End Sub


    Function DBCon() As System.Data.OleDb.OleDbConnection
        Try
            Dim Path As String = Server.MapPath(".") & "\BajaSalsa.mdb"
            'Build Connection String
            Dim CString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
                Server.MapPath("BajaSalsa.mdb")
            'Open Database
            DBCon = New System.Data.OleDb.OleDbConnection(CString)
            DBCon.Open()
        Catch

        End Try
    End Function
    Function CloseDBCon(ByVal m_DBCon As System.Data.OleDb.OleDbConnection) As Boolean
        Try
            m_DBCon.Close()
        Catch

        End Try
    End Function

    Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires at the beginning of each request
    End Sub

    Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires upon attempting to authenticate the use
    End Sub

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when an error occurs
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the session ends
        Session("UserCart") = Nothing
        CloseDBCon(Session("DBCon"))
    End Sub

    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application ends
    End Sub

End Class



Thank for any help!!!!!!!!!!!!!!
0
Comment
Question by:daddyrat
  • 4
  • 2
6 Comments
 
LVL 6

Expert Comment

by:sara110
ID: 16781800
instead of source (src you wrote  Scr="uc_shopping_cart.ascx")
0
 
LVL 6

Expert Comment

by:sara110
ID: 16781802
and it hasn't this attribute :-)  good luck
0
 
LVL 6

Accepted Solution

by:
sara110 earned 2000 total points
ID: 16781807
<%@ Register TagPrefix="uc1" TagName="un_shopping_cart" Src="uc_shopping_cart.ascx" %>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:daddyrat
ID: 16786107
"Thank for the advice, everything worked out."  

Now I have created a StartPage.aspx trying to link to the database with a hyperlink to another called index.aspx.  

I get this error:  Could not find file 'c:\inetpub\wwwroot\BajaSalsa\BajaSalsa.mdb'.

My Hyperlink:

<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 32px" runat="server" Font-Size="XX-Large" BorderStyle="Double" BackColor="Yellow" BorderColor="Red" Font-Names="Trebuchet MS" ForeColor="Firebrick" NavigateUrl="index.aspx" Target="_new">Customers</asp:HyperLink>


The page I'm trying to hyperlink to:

Public Class index
    Inherits System.Web.UI.Page
    Protected WithEvents lblCart As System.Web.UI.WebControls.Label
    Private DTRProducts As System.Data.OleDb.OleDbDataReader
    Private DTRCategory As System.Data.OleDb.OleDbDataReader
    Private DB As New System.Data.OleDb.OleDbConnection
    Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lblCartStatus As System.Web.UI.WebControls.Label
    Protected WithEvents DGrid As System.Web.UI.WebControls.DataGrid
    Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents HyperLink3 As System.Web.UI.WebControls.HyperLink

    Protected WithEvents STRONG1 As System.Web.UI.HtmlControls.HtmlGenericControl
    Private Products As uc_shopping_cart
    Private UserCart As New CShoppingCart
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Try
            If IsPostBack Then
            Else
                UserCart = Session("UserCart")
                Me.lblCartStatus.Text = "Shopping Cart: " & UserCart.Display(Session("DBCon"))
                LoadData(Request.QueryString("category"))
            End If
        Catch ex As System.Exception

        End Try
    End Sub



    Private Sub LoadData(Optional ByVal Key As Long = 0)
        Try
            If Key = 0 Then Key = 1
            Dim DB As New System.Data.OleDb.OleDbConnection
            Dim DA As System.Data.OleDb.OleDbDataAdapter
            Dim DS As System.Data.DataSet
            DB = Session("DBCon")
            Dim SQL As String
            SQL = "Select * From qryProducts Where CategoryID=" & Key
            DA = New System.Data.OleDb.OleDbDataAdapter(SQL, DB)
            DS = New System.Data.DataSet
            DA.Fill(DS)
            DGrid.DataSource = DS
            DGrid.DataKeyField = "ProductID"
            DGrid.DataBind()
        Catch ex As System.Exception
            Response.Write(ex.Message)
        Finally

        End Try
    End Sub


    Private Sub DGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DGrid.ItemCommand
        Try
            Dim itemCell As TableCell = e.Item.Cells(0)
            Dim item As String = itemCell.Text
            Dim txtQuantity As TextBox = e.Item.Cells(4).Controls(1)
            Dim Quantity As String = txtQuantity.Text
            If CType(e.CommandSource, LinkButton).CommandName = "AddToCart" Then
                UserCart = Session("UserCart")
                UserCart.Add(Quantity, item)
                Response.Write("<bgsound src='images/ching.wav' id='ching' loop='1'>")
                Me.lblCartStatus.Text = UserCart.Display(Session("DBCon"))
                Session("UserCart") = UserCart
            End If
        Catch ex As System.Exception
            Response.Write(ex.Message)
        End Try

    End Sub

    Private Sub DGrid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DGrid.SelectedIndexChanged

    End Sub
End Class
0
 

Author Comment

by:daddyrat
ID: 16786126
Now I have created a StartPage.aspx trying to link to the database with a hyperlink to another called index.aspx.  

I get this error:  Could not find file 'c:\inetpub\wwwroot\BajaSalsa\BajaSalsa.mdb'.

My Hyperlink:

<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 32px" runat="server" Font-Size="XX-Large" BorderStyle="Double" BackColor="Yellow" BorderColor="Red" Font-Names="Trebuchet MS" ForeColor="Firebrick" NavigateUrl="index.aspx" Target="_new">Customers</asp:HyperLink>


The page I'm trying to hyperlink to:

Public Class index
    Inherits System.Web.UI.Page
    Protected WithEvents lblCart As System.Web.UI.WebControls.Label
    Private DTRProducts As System.Data.OleDb.OleDbDataReader
    Private DTRCategory As System.Data.OleDb.OleDbDataReader
    Private DB As New System.Data.OleDb.OleDbConnection
    Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents lblCartStatus As System.Web.UI.WebControls.Label
    Protected WithEvents DGrid As System.Web.UI.WebControls.DataGrid
    Protected WithEvents HyperLink2 As System.Web.UI.WebControls.HyperLink
    Protected WithEvents HyperLink3 As System.Web.UI.WebControls.HyperLink

    Protected WithEvents STRONG1 As System.Web.UI.HtmlControls.HtmlGenericControl
    Private Products As uc_shopping_cart
    Private UserCart As New CShoppingCart
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Try
            If IsPostBack Then
            Else
                UserCart = Session("UserCart")
                Me.lblCartStatus.Text = "Shopping Cart: " & UserCart.Display(Session("DBCon"))
                LoadData(Request.QueryString("category"))
            End If
        Catch ex As System.Exception

        End Try
    End Sub



    Private Sub LoadData(Optional ByVal Key As Long = 0)
        Try
            If Key = 0 Then Key = 1
            Dim DB As New System.Data.OleDb.OleDbConnection
            Dim DA As System.Data.OleDb.OleDbDataAdapter
            Dim DS As System.Data.DataSet
            DB = Session("DBCon")
            Dim SQL As String
            SQL = "Select * From qryProducts Where CategoryID=" & Key
            DA = New System.Data.OleDb.OleDbDataAdapter(SQL, DB)
            DS = New System.Data.DataSet
            DA.Fill(DS)
            DGrid.DataSource = DS
            DGrid.DataKeyField = "ProductID"
            DGrid.DataBind()
        Catch ex As System.Exception
            Response.Write(ex.Message)
        Finally

        End Try
    End Sub


    Private Sub DGrid_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DGrid.ItemCommand
        Try
            Dim itemCell As TableCell = e.Item.Cells(0)
            Dim item As String = itemCell.Text
            Dim txtQuantity As TextBox = e.Item.Cells(4).Controls(1)
            Dim Quantity As String = txtQuantity.Text
            If CType(e.CommandSource, LinkButton).CommandName = "AddToCart" Then
                UserCart = Session("UserCart")
                UserCart.Add(Quantity, item)
                Response.Write("<bgsound src='images/ching.wav' id='ching' loop='1'>")
                Me.lblCartStatus.Text = UserCart.Display(Session("DBCon"))
                Session("UserCart") = UserCart
            End If
        Catch ex As System.Exception
            Response.Write(ex.Message)
        End Try

    End Sub

    Private Sub DGrid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DGrid.SelectedIndexChanged

    End Sub
End Class

0
 
LVL 6

Expert Comment

by:sara110
ID: 16787198
where is ur db file and where is ur connection string to your db??
and also is IWAN-your computer name has access read and right to your db??
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question