Using Boolean Values

Discussion in 'ASP .Net' started by Paul, Apr 20, 2006.

  1. Paul

    Paul Guest

    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
     
    Paul, Apr 20, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prozon
    Replies:
    2
    Views:
    8,800
    sushil.jinder
    Jun 15, 2007
  2. vighnesh
    Replies:
    3
    Views:
    1,029
    Paul Clement
    Aug 4, 2005
  3. Replies:
    0
    Views:
    275
  4. J Leonard
    Replies:
    4
    Views:
    12,693
    Mark Space
    Jan 19, 2008
  5. Metre Meter
    Replies:
    7
    Views:
    379
    Metre Meter
    Aug 6, 2010
Loading...

Share This Page