|
 |
aspx thread: HELP !!! NameSpace ex....
Message #1 by "Betti Alessandro" <betti@t...> on Fri, 5 Jan 2001 13:55:19 -0000
|
|
This is the nameSpace:
-----------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SQL
Imports System.Collections
Namespace DBUSER
Public Class USERClass
Public Function GetUser() as DataView
Dim DS As DataSet
Dim MyConnection As SQLConnection
Dim MyCommand As SQLDataSetCommand
MyConnection = New
SQLConnection("server=localhost;uid=sa;pwd=;database=data")
MyCommand = New SQLDataSetCommand("select * from Users",
MyConnection)
DS = new DataSet()
MyCommand.FillDataSet(ds, "Users")
GetUser=ds.Tables("Users").DefaultView
End Function
End Class
End Namespace
------------------------------------------------------------------------
This is the Page
------------------------------------------------------------------------
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="DBUSER" %>
html>
<head>
<title>GrocerToGo</title>
<script language="VB" runat=server>
public Sub Page_Load(sender As Object, e As EventArgs)
if (Not IsPostBack) Then
ProductListing.DataSource = USERClass.GetUser()
ProductListing.DataBind()
End If
End Sub
</script>
</head>
<body>
<ASP:DataGrid id="ProductListing" runat="server"
AllowPaging="True"
PageSize="3"
PageCount="1"
PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="Right"
BorderColor="black"
BorderWidth="1"
GridLines="Both"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle-BackColor="#00aaaa">
</asp:DataGrid>
</body>
</html>
--------------------------------------------------------------------------
When i call my page :
--------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the specific error details
below and modify your source code appropriately.
Compiler Error Message: BC30469: This reference to a non-shared member
requires an object reference, and none is supplied.
Source Error:
Line 11:
Line 12:
Line 13: ProductListing.DataSource = USERClass.GetUser()
Line 14:
Line 15: ProductListing.DataBind()
------------------------------------------------------------------------
Someone Know ?
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
---
You are currently subscribed to aspx as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #2 by Scott Watermasysk <swatermasysk@C...> on Fri, 5 Jan 2001 09:45:31 -0500
|
|
Again, I am new to ASP.Net.
What are NameSpace's? Are they like SSI?
Thanks,
Scott
-----Original Message-----
From: Betti Alessandro [mailto:betti@t...]
Sent: Friday, January 05, 2001 8:55 AM
To: ASP+
Subject: [aspx] HELP !!! NameSpace ex....
This is the nameSpace:
-----------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SQL
Imports System.Collections
Namespace DBUSER
Public Class USERClass
Public Function GetUser() as DataView
Dim DS As DataSet
Dim MyConnection As SQLConnection
Dim MyCommand As SQLDataSetCommand
MyConnection = New
SQLConnection("server=localhost;uid=sa;pwd=;database=data")
MyCommand = New SQLDataSetCommand("select * from Users",
MyConnection)
DS = new DataSet()
MyCommand.FillDataSet(ds, "Users")
GetUser=ds.Tables("Users").DefaultView
End Function
End Class
End Namespace
------------------------------------------------------------------------
This is the Page
------------------------------------------------------------------------
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="DBUSER" %>
html>
<head>
<title>GrocerToGo</title>
<script language="VB" runat=server>
public Sub Page_Load(sender As Object, e As EventArgs)
if (Not IsPostBack) Then
ProductListing.DataSource = USERClass.GetUser()
ProductListing.DataBind()
End If
End Sub
</script>
</head>
<body>
<ASP:DataGrid id="ProductListing" runat="server"
AllowPaging="True"
PageSize="3"
PageCount="1"
PagerStyle-Mode="NumericPages"
PagerStyle-HorizontalAlign="Right"
BorderColor="black"
BorderWidth="1"
GridLines="Both"
CellPadding="3"
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
AlternatingItemStyle-BackColor="#00aaaa">
</asp:DataGrid>
</body>
</html>
--------------------------------------------------------------------------
When i call my page :
--------------------------------------------------------------------------
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the specific error details
below and modify your source code appropriately.
Compiler Error Message: BC30469: This reference to a non-shared member
requires an object reference, and none is supplied.
Source Error:
Line 11:
Line 12:
Line 13: ProductListing.DataSource = USERClass.GetUser()
Line 14:
Line 15: ProductListing.DataBind()
------------------------------------------------------------------------
Someone Know ?
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
swatermasysk@c...
To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
---
You are currently subscribed to aspx as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #3 by "Ben Prater" <bprater@p...> on Fri, 5 Jan 2001 10:37:17 -0500
|
|
Scott,
Let's pretend Jack and Jill both develop server-side components for ASP.NET.
Unaware to either, they've both been working on a tag called 'navigation'.
Jack's offers website navigation with his tag, while Jill's allows for 'picture
navigation' inside a DHTML element.
They both release their components on the market and JimBob buys both of them
for his site.
With namespaces, we don't get namespace collision, when JimBob lays out his page
he can call each independantly:
<fun_html_stuff>
<jack:navigation parameters="go_here">
<more_html_stuff>
<jill:navigation parameters="go_here">
<end_html_stuff>
Otherwise, JimBob would have two <navigation> tags -- and would be stuck with
reprogramming them. This is one of the strong reasons for using namespaces.
Ben
> -----Original Message-----
> From: Scott Watermasysk [mailto:swatermasysk@C...]
> Sent: Friday, January 05, 2001 9:46 AM
> To: ASP+
> Subject: [aspx] RE: HELP !!! NameSpace ex....
>
>
> Again, I am new to ASP.Net.
>
> What are NameSpace's? Are they like SSI?
>
> Thanks,
> Scott
>
> -----Original Message-----
> From: Betti Alessandro [mailto:betti@t...]
> Sent: Friday, January 05, 2001 8:55 AM
> To: ASP+
> Subject: [aspx] HELP !!! NameSpace ex....
>
>
> This is the nameSpace:
> -----------------------------------------------------------------
> Imports System
> Imports System.Data
> Imports System.Data.SQL
> Imports System.Collections
>
> Namespace DBUSER
>
> Public Class USERClass
>
> Public Function GetUser() as DataView
>
> Dim DS As DataSet
> Dim MyConnection As SQLConnection
> Dim MyCommand As SQLDataSetCommand
>
> MyConnection = New
> SQLConnection("server=localhost;uid=sa;pwd=;database=data")
> MyCommand = New SQLDataSetCommand("select * from Users",
> MyConnection)
>
> DS = new DataSet()
> MyCommand.FillDataSet(ds, "Users")
>
> GetUser=ds.Tables("Users").DefaultView
>
>
>
> End Function
>
>
> End Class
> End Namespace
>
> ------------------------------------------------------------------------
> This is the Page
> ------------------------------------------------------------------------
>
> <%@ Import Namespace="System.Data" %>
> <%@ Import Namespace="DBUSER" %>
> html>
> <head>
> <title>GrocerToGo</title>
> <script language="VB" runat=server>
>
> public Sub Page_Load(sender As Object, e As EventArgs)
>
> if (Not IsPostBack) Then
>
>
> ProductListing.DataSource = USERClass.GetUser()
>
> ProductListing.DataBind()
>
> End If
> End Sub
>
>
>
> </script>
>
> </head>
>
> <body>
>
> <ASP:DataGrid id="ProductListing" runat="server"
> AllowPaging="True"
> PageSize="3"
> PageCount="1"
> PagerStyle-Mode="NumericPages"
> PagerStyle-HorizontalAlign="Right"
> BorderColor="black"
> BorderWidth="1"
> GridLines="Both"
> CellPadding="3"
> CellSpacing="0"
> Font-Name="Verdana"
> Font-Size="8pt"
> HeaderStyle-BackColor="#aaaadd"
> AlternatingItemStyle-BackColor="#00aaaa">
> </asp:DataGrid>
> </body>
> </html>
> --------------------------------------------------------------------------
> When i call my page :
> --------------------------------------------------------------------------
>
> Compilation Error
> Description: An error occurred during the compilation of a resource
> required to service this request. Please review the specific error details
> below and modify your source code appropriately.
>
> Compiler Error Message: BC30469: This reference to a non-shared member
> requires an object reference, and none is supplied.
>
> Source Error:
>
>
>
> Line 11:
> Line 12:
> Line 13: ProductListing.DataSource = USERClass.GetUser()
> Line 14:
> Line 15: ProductListing.DataBind()
> ------------------------------------------------------------------------
>
> Someone Know ?
>
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
---
You are currently subscribed to aspx as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #4 by "James A. Dooley" <jdooley@w...> on Fri, 05 Jan 2001 16:59:24 +0100
|
|
You need to create an instance of the class in your page
before you can call the method.
Regards,
James.
At 01:55 PM 1/5/01 +0000, you wrote:
>This is the nameSpace:
>-----------------------------------------------------------------
>Imports System
>Imports System.Data
>Imports System.Data.SQL
>Imports System.Collections
>
>Namespace DBUSER
>
> Public Class USERClass
>
> Public Function GetUser() as DataView
>
> Dim DS As DataSet
> Dim MyConnection As SQLConnection
> Dim MyCommand As SQLDataSetCommand
>
> MyConnection = New
>SQLConnection("server=localhost;uid=sa;pwd=;database=data")
> MyCommand = New SQLDataSetCommand("select * from Users",
>MyConnection)
>
> DS = new DataSet()
> MyCommand.FillDataSet(ds, "Users")
>
> GetUser=ds.Tables("Users").DefaultView
>
>
>
> End Function
>
>
>End Class
>End Namespace
>
>------------------------------------------------------------------------
>This is the Page
>------------------------------------------------------------------------
>
><%@ Import Namespace="System.Data" %>
><%@ Import Namespace="DBUSER" %>
>html>
><head>
> <title>GrocerToGo</title>
><script language="VB" runat=server>
>
> public Sub Page_Load(sender As Object, e As EventArgs)
>
> if (Not IsPostBack) Then
>
>
> ProductListing.DataSource = USERClass.GetUser()
>
> ProductListing.DataBind()
>
> End If
> End Sub
>
>
>
> </script>
>
></head>
>
><body>
>
> <ASP:DataGrid id="ProductListing" runat="server"
> AllowPaging="True"
> PageSize="3"
> PageCount="1"
> PagerStyle-Mode="NumericPages"
> PagerStyle-HorizontalAlign="Right"
> BorderColor="black"
> BorderWidth="1"
> GridLines="Both"
> CellPadding="3"
> CellSpacing="0"
> Font-Name="Verdana"
> Font-Size="8pt"
> HeaderStyle-BackColor="#aaaadd"
> AlternatingItemStyle-BackColor="#00aaaa">
></asp:DataGrid>
></body>
></html>
>--------------------------------------------------------------------------
>When i call my page :
>--------------------------------------------------------------------------
>
>Compilation Error
>Description: An error occurred during the compilation of a resource
>required to service this request. Please review the specific error details
>below and modify your source code appropriately.
>
>Compiler Error Message: BC30469: This reference to a non-shared member
>requires an object reference, and none is supplied.
>
>Source Error:
>
>
>
>Line 11:
>Line 12:
>Line 13: ProductListing.DataSource = USERClass.GetUser()
>Line 14:
>Line 15: ProductListing.DataBind()
> ------------------------------------------------------------------------
>
>Someone Know ?
>
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
---
You are currently subscribed to aspx as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #5 by "Alessandro Betti" <betti@t...> on Fri, 5 Jan 2001 17:53:02 +0100
|
|
-----Original Message-----
From: James A. Dooley <jdooley@w...>
To: ASP+ <aspx@p...>
Date: 05 January 2001 17:11
Subject: [aspx] Re: HELP !!! NameSpace ex....
>You need to create an instance of the class in your page
>before you can call the method.
>
>Regards,
>
>James.
I made two mistake
1° you need to compile the .dll with the same name of NameSpace
If you have a User.vb that contain Namespace User and when you compile
you must put
out file to user.dll
vbc /out:user.dll /t:library user.vb
2° I needed to create an instance of the class in my page
<%Import Namespace="USER" %>
then in the code
dim obj as new UserClass
after i will can use method ...
Thank you to EveryBody
Betti Alessandro
---
http://www.asptoday.com - the leading site for timely,
in-depth information for ASP developers everywhere.
---
You are currently subscribed to aspx as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-aspx-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |