adonweb
05-12-2008, 08:08 AM
I am trying to display the products from sql server database. But when i try to access the page, i get the error.
BC30002: Type 'products.getproducts' is not defined
my vb code is successfully compiled to dll. Wht i am doing wrong? Please help me. I searched on msdn and google, couldnt find proper solution.
' VB Document
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Namespace products
Public Class getproducts
Public Function getallproducts() as SqlDataReader
Dim mycon as SqlConnection=New SqlConnection ("database=databasename;server=servername;uid=xxx;password=xxx")
Dim mycommand as SqlCommand=New SqlCommand("select * from categories",mycon)
Dim reader as SqlDataReader
mycon.Open()
Return mycommand.ExecuteReader(CommandBehavior.CloseConnection)
End Function
End Class
End Namespace
Here is my aspx page..
<script language="vb" runat="server">
Sub Page_Load(sender as Object,e as EventArgs)
loadgrid(grid)
End Sub
Private Sub loadgrid(mydatagrid as System.Web.UI.WebControls.DataGrid)
Dim dat as New products.getproducts()
mydatagrid.DataSource=dat.getallproducts()
mydatagrid.DataBind()
End Sub
</script>
</head>
<body>
<form runat="server" id="frm">
<asp:DataGrid id="grid" runat="server"></asp:DataGrid>
</form>
</body>
BC30002: Type 'products.getproducts' is not defined
my vb code is successfully compiled to dll. Wht i am doing wrong? Please help me. I searched on msdn and google, couldnt find proper solution.
' VB Document
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Namespace products
Public Class getproducts
Public Function getallproducts() as SqlDataReader
Dim mycon as SqlConnection=New SqlConnection ("database=databasename;server=servername;uid=xxx;password=xxx")
Dim mycommand as SqlCommand=New SqlCommand("select * from categories",mycon)
Dim reader as SqlDataReader
mycon.Open()
Return mycommand.ExecuteReader(CommandBehavior.CloseConnection)
End Function
End Class
End Namespace
Here is my aspx page..
<script language="vb" runat="server">
Sub Page_Load(sender as Object,e as EventArgs)
loadgrid(grid)
End Sub
Private Sub loadgrid(mydatagrid as System.Web.UI.WebControls.DataGrid)
Dim dat as New products.getproducts()
mydatagrid.DataSource=dat.getallproducts()
mydatagrid.DataBind()
End Sub
</script>
</head>
<body>
<form runat="server" id="frm">
<asp:DataGrid id="grid" runat="server"></asp:DataGrid>
</form>
</body>