A
Arpan
This is how I am creating a simple business object:
'This code exists in a class file named MyDatabase.vb
Imports System
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNETDB
Public Class MyDatabase
End Class
End Namespace
The above VB file exists in the the folder
C:\Inetpub\wwwroot\ASPX\Business.
This is the command I am using in a command prompt window to compile
the above VB file into a DLL file named ASPNETDB.dll (after compiling,
the DLL will be created in the folder C:\Inetpub\wwwroot\ASPX\bin):
C:\Inetpub\wwwroot\ASPX\bin>C:\WINNT\Microsoft.NET\Framework\v2.0.50727\vbc.exe
/t:library /out:ASPNETDB.dll /r:System.dll /r:System.Data.dll
...\Business\MyDatabase.vb
The above command successfully creates ASPNETDB.dll in the
C:\Inetpub\wwwroot\ASPX\bin\ folder but when I try to access this
business object in an ASPX page using the following simple code:
<%@ Import Namespace="ASPNETDB" %>
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim boDatabase As New MyDatabase
lblMessage.Text = "Object Created"
End Sub
</script>
<form runat="server">
<asp:Label ID="lblMessage" runat="server"/>
</form>
ASP.NET generates the following error:
Type 'MyDatabase' is not defined.
pointing to the Dim boDatabase As New MyDatabase line.
Can someone please point out where am I going wrong?
Thanks,
Arpan
'This code exists in a class file named MyDatabase.vb
Imports System
Imports System.Data
Imports System.Data.SqlClient
Namespace ASPNETDB
Public Class MyDatabase
End Class
End Namespace
The above VB file exists in the the folder
C:\Inetpub\wwwroot\ASPX\Business.
This is the command I am using in a command prompt window to compile
the above VB file into a DLL file named ASPNETDB.dll (after compiling,
the DLL will be created in the folder C:\Inetpub\wwwroot\ASPX\bin):
C:\Inetpub\wwwroot\ASPX\bin>C:\WINNT\Microsoft.NET\Framework\v2.0.50727\vbc.exe
/t:library /out:ASPNETDB.dll /r:System.dll /r:System.Data.dll
...\Business\MyDatabase.vb
The above command successfully creates ASPNETDB.dll in the
C:\Inetpub\wwwroot\ASPX\bin\ folder but when I try to access this
business object in an ASPX page using the following simple code:
<%@ Import Namespace="ASPNETDB" %>
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim boDatabase As New MyDatabase
lblMessage.Text = "Object Created"
End Sub
</script>
<form runat="server">
<asp:Label ID="lblMessage" runat="server"/>
</form>
ASP.NET generates the following error:
Type 'MyDatabase' is not defined.
pointing to the Dim boDatabase As New MyDatabase line.
Can someone please point out where am I going wrong?
Thanks,
Arpan