Using Boolean Values

P

Paul

Let's say I have a SPROC that returns a boolean value:
PROCEDURE [DBO].[StoreHasOwnMasterPageBool]
(
@StoreID int
)
AS
SET NOCOUNT ON;
SELECT HasOwnMasterPage
FROM dbo.Stores
WHERE (StoreID = @StoreID)

Where the Column HasOwnMasterPage is of type Boolean in SQL Server 2005.

In my XSD file, StorePresentationDS.xsd, I have a TableAdapter called
StoreHasOwnMasterPageBoolTableAdapter, and off this I have a Query (a
GetMethodName) called GetBoolStoreMasterPage. It works.

In my Business Layer, I would like to retrieve a value from that dataset, to
then pass to a code-behind of an aspx page.
I guess that I could code something like this:
Public Function HasOwnMasterPage(ByVal StoreID As Integer) As Boolean

Dim StoreMasterPageBool As New
StorePresentationDSTableAdapters.StoreHasOwnMasterPageBoolTableAdapter

If StoreMasterPageBool.ToString = "True" Then

Return True

Else

Return False

End If

End Function

----
But is there something better? What is it best way to treat a boolean result
of a Stored Procedure? Somehow going from Bool to string looks wastful.

TIA, (I love this stuff, but wish I knew more)

Paul
 

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

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top