Jump to content

Type not defined error


Dug

Recommended Posts

Hi all,I'm following the book Sams Teach Yourself ASP.NET in 21 Days, and I get the error:

Type 'Database' is not defined
and it points to this line of code:
dim objDatabase as new Database

I've got my Database.vb file with the following code:

Imports SystemImports System.DataImports System.Data.OleDbNamespace TYASPNET	Public Class Database	End Class	End Namespace

and I've declared the Namespace in the ASP.NET page:

<%@ Import Namespace="TYASPNET" %>

I've compiled the DLL which is now in the Bin folder with the following command:

vbc /t:library /out:Bin\TYASPNET.dll /r:System.dll /r:System.dll /r:System.Data.dll vb\Database.vb
and that part has worked fine.I've tried everything... tripple checking the spelling... that's all fine... I've tried putting the Database.vb file in the App_Code and aspnet_client directories, but it doesn't make any difference. This kind of error is easy to spot in a straight forward ASP.NET page... I got it to work before, but that was using Visual Studio... want to understand how to do it manually. I don't really need it for my site but it's useful to know. Gonna sleep on it and try again tomorrow.Any help would be appreciated.CheersDug
Link to comment
Share on other sites

  • 3 weeks later...
Does no one know, or are people just too lazy?
I'm pretty lazy, yes :) but actually I haven't been around here for a while... so on both counts I have only just seen your post. I have not read that book, but I have to say that in all the time I've spent using ADO.NET I have never heard of anyone defining their own database class for ADO.NET. Why on earth would anyone want to do that? Perhaps for a special purpose, yes, but in an ADO.NET beginner's tutorial??!!! It seems an unneccessary obstacle, to put it mildly. So my advice is, rather than work out why your database type is not being found, put that book down and get the information on learning ADO.NET from the horse's mouth:http://msdn2.microsoft.com/en-us/data/aa937699.aspxand for your database, get the free SQL express download if you don't have it already:http://www.microsoft.com/sql/editions/express/default.mspx
Link to comment
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...