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
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