BC30002 problem

J

Jason Callas

I have a simple class written in vb.net:

'SongsDb.vb
Imports System.Configuration
Imports System.Data
Imports Microsoft.Data.Odbc

Namespace AquehongaPortal
Public Class SongsDb
Public Function GetSongs() As DataSet
Dim sql As String

' build sql statement
sql = "SELECT SongId,Title,Body,Type,PostedBy FROM Song WHERE ApprovedFlag = 1"

' create instance of Connection and DataAdapter object
Dim dbConn As New OdbcConnection(ConfigurationSettings.AppSettings("ConnectString"))
Dim dbDA As New OdbcDataAdapter(sql, dbConn)

' create and fill the DataSet
Dim dbDS As New DataSet()
dbDA.Fill(dbDS)

' give it back
Return dbDS
End Function
End Class
End Namespace

And a simple test web page:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="AquehongaPortal" %>

<script runAt="Server">

Sub Page_Load(sender As Object, e As EventArgs)
Dim songs As AquehongaPortal.SongsDb = New AquehongaPortal.SongsDb()
End Sub

</script>

<html>

<head>
<title>Test Page</title>
</head>

<body>
Test
</body>

</html>

The vb file was compiled and copied to the /bin folder of the default application.

As far as I know that is all I am supposed to do, yet I still get the error BC30002: Type 'AquehongaPortal.SongsDb' is not defined.

Any thoughts?

Thanks.
 
J

JD

Is the songsdb.vb getting compiled to the same assembly as the web page?

I have a simple class written in vb.net:

'SongsDb.vb
Imports System.Configuration
Imports System.Data
Imports Microsoft.Data.Odbc

Namespace AquehongaPortal
Public Class SongsDb
Public Function GetSongs() As DataSet
Dim sql As String

' build sql statement
sql = "SELECT SongId,Title,Body,Type,PostedBy FROM Song WHERE ApprovedFlag = 1"

' create instance of Connection and DataAdapter object
Dim dbConn As New OdbcConnection(ConfigurationSettings.AppSettings("ConnectString"))
Dim dbDA As New OdbcDataAdapter(sql, dbConn)

' create and fill the DataSet
Dim dbDS As New DataSet()
dbDA.Fill(dbDS)

' give it back
Return dbDS
End Function
End Class
End Namespace

And a simple test web page:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="AquehongaPortal" %>

<script runAt="Server">

Sub Page_Load(sender As Object, e As EventArgs)
Dim songs As AquehongaPortal.SongsDb = New AquehongaPortal.SongsDb()
End Sub

</script>

<html>

<head>
<title>Test Page</title>
</head>

<body>
Test
</body>

</html>

The vb file was compiled and copied to the /bin folder of the default application.

As far as I know that is all I am supposed to do, yet I still get the error BC30002: Type 'AquehongaPortal.SongsDb' is not defined.

Any thoughts?

Thanks.
 
J

Jason Callas

Thanks for applying but I figured it out.

Because I created the vb file in VS.NET it decided to add its own namespace (named SongsDb) to the project.

Soooo.... With my own namespace statement the full namespace became SongsDb.AquehongaPortal.SongsDb.

All cleaned up and working.

(To answer your question JD --- no. The vb file was compiled completely separately. Would not even be sure HOW to get a web
page to be included as part of an assembly)

- Jason


Is the songsdb.vb getting compiled to the same assembly as the web page?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top