Basic N-Tiered structure in VB

Discussion in 'ASP .Net' started by Paul, Jun 9, 2006.

  1. Paul

    Paul Guest

    I have an xsd file called zTest.xsd. In it, I have a DataTable called
    CategoryCountByStore, a TableAdapter that is generated automatically called
    CategoryCountByStoreTableAdapter, and a GetMethod name
    etCategoryCount )which gets the value from a Stored Procedure). Using
    Visual Studio 2005 and testing by Preview Data" it works fine, returning an
    integer reflecting a SQL Count. (e.g. running the
    preview...Results:CategoryCountByStore = 4, for some StoreID that is filled
    in in the value column.)

    I have a file under the folder App_Code called Stores.vb. In it, I have the
    statement:

    Public Function CategoryCountByStore(ByVal StoreID As Integer)
    Dim CountCategoriesByStore As New
    zTestTableAdapters.CategoryCountByStoreTableAdapter
    Return CountCategoriesByStore.GetCategoryCount(StoreID)
    End Function

    I get no error messages (I know that means little).

    Now, I would like to get that value displayed on a WebPage, so I tried, in
    the page's code-behind: (The Label2 is in the html section)

    Dim myCategoryCount As New Stores
    Dim StoreID As Integer = 2
    Label2.Text = myCategoryCount.CategoryCountByStore(StoreID).ToString.

    But I do not get the value I expected (I get the label saying
    CategoryCountByStore).

    Could you please go over how to get a value from a DataSet, as Visual Studio
    makes easy now, to a Class (object?) and then to the page?

    TIA,

    Paul
     
    Paul, Jun 9, 2006
    #1
    1. Advertising

  2. Paul

    Paul Guest

    Thanks. Where would I cast?


    "Jorge Bustos" <> wrote in message
    news:...
    > Cast "myCategoryCount.CategoryCountByStore(StoreID)" to the appropriate
    > numeric type before calling to ToString()
    >
    >
    > "Paul" <> wrote in message
    > news:Rkeig.114$...
    >> I have an xsd file called zTest.xsd. In it, I have a DataTable called
    >> CategoryCountByStore, a TableAdapter that is generated automatically

    > called
    >> CategoryCountByStoreTableAdapter, and a GetMethod name
    >> etCategoryCount )which gets the value from a Stored Procedure). Using
    >> Visual Studio 2005 and testing by Preview Data" it works fine, returning

    > an
    >> integer reflecting a SQL Count. (e.g. running the
    >> preview...Results:CategoryCountByStore = 4, for some StoreID that is

    > filled
    >> in in the value column.)
    >>
    >> I have a file under the folder App_Code called Stores.vb. In it, I have

    > the
    >> statement:
    >>
    >> Public Function CategoryCountByStore(ByVal StoreID As Integer)
    >> Dim CountCategoriesByStore As New
    >> zTestTableAdapters.CategoryCountByStoreTableAdapter
    >> Return CountCategoriesByStore.GetCategoryCount(StoreID)
    >> End Function
    >>
    >> I get no error messages (I know that means little).
    >>
    >> Now, I would like to get that value displayed on a WebPage, so I tried,
    >> in
    >> the page's code-behind: (The Label2 is in the html section)
    >>
    >> Dim myCategoryCount As New Stores
    >> Dim StoreID As Integer = 2
    >> Label2.Text = myCategoryCount.CategoryCountByStore(StoreID).ToString.
    >>
    >> But I do not get the value I expected (I get the label saying
    >> CategoryCountByStore).
    >>
    >> Could you please go over how to get a value from a DataSet, as Visual

    > Studio
    >> makes easy now, to a Class (object?) and then to the page?
    >>
    >> TIA,
    >>
    >> Paul
    >>
    >>
    >>
    >>

    >
    >
     
    Paul, Jun 9, 2006
    #2
    1. Advertising

  3. Paul

    Jorge Bustos Guest

    Cast "myCategoryCount.CategoryCountByStore(StoreID)" to the appropriate
    numeric type before calling to ToString()


    "Paul" <> wrote in message
    news:Rkeig.114$...
    > I have an xsd file called zTest.xsd. In it, I have a DataTable called
    > CategoryCountByStore, a TableAdapter that is generated automatically

    called
    > CategoryCountByStoreTableAdapter, and a GetMethod name
    > etCategoryCount )which gets the value from a Stored Procedure). Using
    > Visual Studio 2005 and testing by Preview Data" it works fine, returning

    an
    > integer reflecting a SQL Count. (e.g. running the
    > preview...Results:CategoryCountByStore = 4, for some StoreID that is

    filled
    > in in the value column.)
    >
    > I have a file under the folder App_Code called Stores.vb. In it, I have

    the
    > statement:
    >
    > Public Function CategoryCountByStore(ByVal StoreID As Integer)
    > Dim CountCategoriesByStore As New
    > zTestTableAdapters.CategoryCountByStoreTableAdapter
    > Return CountCategoriesByStore.GetCategoryCount(StoreID)
    > End Function
    >
    > I get no error messages (I know that means little).
    >
    > Now, I would like to get that value displayed on a WebPage, so I tried, in
    > the page's code-behind: (The Label2 is in the html section)
    >
    > Dim myCategoryCount As New Stores
    > Dim StoreID As Integer = 2
    > Label2.Text = myCategoryCount.CategoryCountByStore(StoreID).ToString.
    >
    > But I do not get the value I expected (I get the label saying
    > CategoryCountByStore).
    >
    > Could you please go over how to get a value from a DataSet, as Visual

    Studio
    > makes easy now, to a Class (object?) and then to the page?
    >
    > TIA,
    >
    > Paul
    >
    >
    >
    >
     
    Jorge Bustos, Jun 9, 2006
    #3
  4. Paul

    Jorge Bustos Guest

    You should so something like this (I don't use VB, but C#, anyway I think
    this is VB's way to do it):

    myCategoryCount.CategoryCountByStore(StoreID)
    returns a generic object.

    CType(int, myCategoryCount.CategoryCountByStore(StoreID))
    -> This converts the generic object to a int (You should choose the
    appropriate type)

    CType(int, myCategoryCount.CategoryCountByStore(StoreID)).ToString()
    -> this hopefully will return just what you want

    Let me know if this solves your problem.

    Jorge


    "Paul" <> wrote in message
    news:Lchig.8$...
    > Thanks. Where would I cast?
    >
    >
    > "Jorge Bustos" <> wrote in message
    > news:...
    > > Cast "myCategoryCount.CategoryCountByStore(StoreID)" to the appropriate
    > > numeric type before calling to ToString()
    > >
    > >
    > > "Paul" <> wrote in message
    > > news:Rkeig.114$...
    > >> I have an xsd file called zTest.xsd. In it, I have a DataTable called
    > >> CategoryCountByStore, a TableAdapter that is generated automatically

    > > called
    > >> CategoryCountByStoreTableAdapter, and a GetMethod name
    > >> etCategoryCount )which gets the value from a Stored Procedure). Using
    > >> Visual Studio 2005 and testing by Preview Data" it works fine,

    returning
    > > an
    > >> integer reflecting a SQL Count. (e.g. running the
    > >> preview...Results:CategoryCountByStore = 4, for some StoreID that is

    > > filled
    > >> in in the value column.)
    > >>
    > >> I have a file under the folder App_Code called Stores.vb. In it, I

    have
    > > the
    > >> statement:
    > >>
    > >> Public Function CategoryCountByStore(ByVal StoreID As Integer)
    > >> Dim CountCategoriesByStore As New
    > >> zTestTableAdapters.CategoryCountByStoreTableAdapter
    > >> Return CountCategoriesByStore.GetCategoryCount(StoreID)
    > >> End Function
    > >>
    > >> I get no error messages (I know that means little).
    > >>
    > >> Now, I would like to get that value displayed on a WebPage, so I tried,
    > >> in
    > >> the page's code-behind: (The Label2 is in the html section)
    > >>
    > >> Dim myCategoryCount As New Stores
    > >> Dim StoreID As Integer = 2
    > >> Label2.Text = myCategoryCount.CategoryCountByStore(StoreID).ToString.
    > >>
    > >> But I do not get the value I expected (I get the label saying
    > >> CategoryCountByStore).
    > >>
    > >> Could you please go over how to get a value from a DataSet, as Visual

    > > Studio
    > >> makes easy now, to a Class (object?) and then to the page?
    > >>
    > >> TIA,
    > >>
    > >> Paul
    > >>
    > >>
    > >>
    > >>

    > >
    > >

    >
    >
     
    Jorge Bustos, Jun 10, 2006
    #4
    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. Andy Fish
    Replies:
    1
    Views:
    424
    Jim Cheshire
    Jan 9, 2006
  2. Thirsty Traveler
    Replies:
    0
    Views:
    398
    Thirsty Traveler
    May 30, 2006
  3. Replies:
    4
    Views:
    449
    Robert Martin
    Jul 6, 2006
  4. Ken Ross

    Tiered architecture question

    Ken Ross, Sep 8, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    364
    Ken Ross
    Sep 8, 2006
  5. Replies:
    0
    Views:
    471
Loading...

Share This Page