Member Avatar for DJ1UK

Hi All,

First post here so be gentle! I'm working through Sams Teach Yourself ASP.Net book and have come across an error with one of the basic examples. The example is to do with .vb and .aspx files and compiling them.

I have succesfully compiled the database.vb file. The contents of database.vb is as follows:

Imports System
Imports System.Data
Imports System.Data.OleDb

Namespace TYASPNET

Public Class Database
End Class
End Namespace

The database.aspx file is as follows:

<%@ Language="VB" %>

<script runat="server">
	sub Page_Load(Sender as Object, e as EventArgs)
	dim objDatabase as new TYASPNET.Database
	lblMessage.Text = "Object Created"
	end sub
</script>

<html><body>
<asp:Label id="lblMessage" runat="server" />
</body></html>

Once compiled the database.dll file is located in the same director as database.vb and database.aspx - is this correct?

When accessing database.aspx the following error occurs:

BC30002: Type 'TYASPNET.Database' is not defined.

I know it must be something simple, but being new to all this I don't know what it is!

Can anyone help? Once this is sorted out it will sort out my other aspx files as I'm having the same problem with them.

Thanks

DJ

Recommended Answers

All 3 Replies

You have missed the Registration of the dll line of code for the page to grab that dll.
<% @.... %>

The books states it.

Double check your code.

My book is at home so I can't give you the exact code right off the top of my head.

:cool:

Hi All,

First post here so be gentle! I'm working through Sams Teach Yourself ASP.Net book and have come across an error with one of the basic examples. The example is to do with .vb and .aspx files and compiling them.

I have succesfully compiled the database.vb file. The contents of database.vb is as follows:

Imports System
Imports System.Data
Imports System.Data.OleDb

Namespace TYASPNET

Public Class Database
End Class
End Namespace

The database.aspx file is as follows:

<%@ Language="VB" %>

<script runat="server">
	sub Page_Load(Sender as Object, e as EventArgs)
	dim objDatabase as new TYASPNET.Database
	lblMessage.Text = "Object Created"
	end sub
</script>

<html><body>
<asp:Label id="lblMessage" runat="server" />
</body></html>

Once compiled the database.dll file is located in the same director as database.vb and database.aspx - is this correct?

When accessing database.aspx the following error occurs:

BC30002: Type 'TYASPNET.Database' is not defined.

I know it must be something simple, but being new to all this I don't know what it is!

Can anyone help? Once this is sorted out it will sort out my other aspx files as I'm having the same problem with them.

Thanks

DJ

Member Avatar for DJ1UK

Thanks. I fixed it by putting the dlls in the bin directory.

thanks

Cool

The line you need for those that don't know :

<%@ Register TagPrefix="TYASPNET" TagName="LoginForm" src="LoginForm.ascx" %>

Thanks. I fixed it by putting the dlls in the bin directory.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.