473,387 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need help with N-Tier construction (Business layer)

Hello, and thanks for listening.

I have a Stored Procedure as follows:
--
PROCEDURE [PaoloPignatelli].[GetOneStoreByUserName3]

-- Add the parameters for the stored procedure here

@UserName Nvarchar (50)

AS

SELECT StoreID

FROM dbo.Stores

WHERE (StoreOwnerUserName = @UserName)

--
This works in SQL Server 2005; I input a UserName, and get a StoreID.
///
In my Website, using the wizard, I created an
XSD file called OneStoreByUserName, and on it a
TableAdapter called GetOneStoreByUserName3DataTableTableAdapter, and a
GetMethodName of
GetStoreIDByUserName.
(it appears as GetMethodName of GetStoreIDByUserName(@UserName,@StoreID) )

When I see if things work so far, they do, I Preview Data, enter a value,
and receive the correct StoreID.

Now comes my question.
How do I write a class (a business layer) that will allow me to access this
data?
I added a Class File to the App_Code folder and called it Stores.vb.
I tried:
Imports Microsoft.VisualBasic

Imports System

Imports System.Data

Public Class Stores
Public Function GetStoreID(ByVal UserName As String) As DataTable

Dim StoreDB As New
OneStoreByUserNameTableAdapters.GetOneStoreByUserN ame3DataTableTableAdapter

Return StoreDB.GetStoreIDByUserName(UserName)

End Function

End Class

---

No errors on page .... (but I know that means little...)

Then on the aspx.vb page where I wish to consume the class I have

---------------

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim UserName As String = "Paolo1"

Dim myStore As New Stores

Label1.Text = myStore.GetStoreID(UserName).ToString()

End Sub

---

I get no errors, but when I view in browser, I also get in the label the
text:

GetOneStoreByUserName3DataTable

and not the integer I was hoping for...

How do I get the label to spit out the integer I need? Any and all help is
appreciated,

Paul

Thanks.



Apr 19 '06 #1
3 1167
in your line:

Label1.Text = myStore.GetStoreID(UserName).ToString()

note that GetStoreID returns a DataTable instance, not a string value. the
ToString function of DataTable return the class name. you proably want to
access a row and column in the datatable.
-- bruce (sqlwork.com)

"Paul" <Pa***********@TheCornerStore.com> wrote in message
news:5K***********@fe09.lga...
Hello, and thanks for listening.

I have a Stored Procedure as follows:
--
PROCEDURE [PaoloPignatelli].[GetOneStoreByUserName3]

-- Add the parameters for the stored procedure here

@UserName Nvarchar (50)

AS

SELECT StoreID

FROM dbo.Stores

WHERE (StoreOwnerUserName = @UserName)

--
This works in SQL Server 2005; I input a UserName, and get a StoreID.
///
In my Website, using the wizard, I created an
XSD file called OneStoreByUserName, and on it a
TableAdapter called GetOneStoreByUserName3DataTableTableAdapter, and a
GetMethodName of
GetStoreIDByUserName.
(it appears as GetMethodName of GetStoreIDByUserName(@UserName,@StoreID) )

When I see if things work so far, they do, I Preview Data, enter a value,
and receive the correct StoreID.

Now comes my question.
How do I write a class (a business layer) that will allow me to access
this data?
I added a Class File to the App_Code folder and called it Stores.vb.
I tried:
Imports Microsoft.VisualBasic

Imports System

Imports System.Data

Public Class Stores
Public Function GetStoreID(ByVal UserName As String) As DataTable

Dim StoreDB As New
OneStoreByUserNameTableAdapters.GetOneStoreByUserN ame3DataTableTableAdapter

Return StoreDB.GetStoreIDByUserName(UserName)

End Function

End Class

---

No errors on page .... (but I know that means little...)

Then on the aspx.vb page where I wish to consume the class I have

---------------

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim UserName As String = "Paolo1"

Dim myStore As New Stores

Label1.Text = myStore.GetStoreID(UserName).ToString()

End Sub

---

I get no errors, but when I view in browser, I also get in the label the
text:

GetOneStoreByUserName3DataTable

and not the integer I was hoping for...

How do I get the label to spit out the integer I need? Any and all help is
appreciated,

Paul

Thanks.


Apr 19 '06 #2
Label1.Text = myStore.GetStoreID(UserName).Rows(0)("ColumnName") .ToString

"Paul" <Pa***********@TheCornerStore.com> wrote in message
news:5K***********@fe09.lga...
Hello, and thanks for listening.

I have a Stored Procedure as follows:
--
PROCEDURE [PaoloPignatelli].[GetOneStoreByUserName3]

-- Add the parameters for the stored procedure here

@UserName Nvarchar (50)

AS

SELECT StoreID

FROM dbo.Stores

WHERE (StoreOwnerUserName = @UserName)

--
This works in SQL Server 2005; I input a UserName, and get a StoreID.
///
In my Website, using the wizard, I created an
XSD file called OneStoreByUserName, and on it a
TableAdapter called GetOneStoreByUserName3DataTableTableAdapter, and a
GetMethodName of
GetStoreIDByUserName.
(it appears as GetMethodName of GetStoreIDByUserName(@UserName,@StoreID) )

When I see if things work so far, they do, I Preview Data, enter a value,
and receive the correct StoreID.

Now comes my question.
How do I write a class (a business layer) that will allow me to access
this data?
I added a Class File to the App_Code folder and called it Stores.vb.
I tried:
Imports Microsoft.VisualBasic

Imports System

Imports System.Data

Public Class Stores
Public Function GetStoreID(ByVal UserName As String) As DataTable

Dim StoreDB As New
OneStoreByUserNameTableAdapters.GetOneStoreByUserN ame3DataTableTableAdapter

Return StoreDB.GetStoreIDByUserName(UserName)

End Function

End Class

---

No errors on page .... (but I know that means little...)

Then on the aspx.vb page where I wish to consume the class I have

---------------

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim UserName As String = "Paolo1"

Dim myStore As New Stores

Label1.Text = myStore.GetStoreID(UserName).ToString()

End Sub

---

I get no errors, but when I view in browser, I also get in the label the
text:

GetOneStoreByUserName3DataTable

and not the integer I was hoping for...

How do I get the label to spit out the integer I need? Any and all help is
appreciated,

Paul

Thanks.


Apr 19 '06 #3
Thanks, that did it!
"MSDN" <sq**********@hotmail.com> wrote in message
news:uM**************@TK2MSFTNGP04.phx.gbl...
Label1.Text = myStore.GetStoreID(UserName).Rows(0)("ColumnName") .ToString

Apr 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its...
15
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit...
3
by: Bob.Henkel | last post by:
I write this to tell you why we won't use postgresql even though we wish we could at a large company. Don't get me wrong I love postgresql in many ways and for many reasons , but fact is fact. If...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
4
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is...
8
by: Sai Kit Tong | last post by:
In the article, the description for "Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" suggests the creation of the class ManagedWrapper. If I...
2
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a...
5
by: HotRod | last post by:
I am new to this so please go easy. We currently have some students doing some work on some web based tracking documents for us. They are currently using VB .net to develop what we requested....
23
by: vinod.bhavnani | last post by:
Hello all, I need desperate help Here is the problem: My problem today is with multidimensional arrays. Lets say i have an array A this is a 4 dimensional static array.
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.