Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Passing data from Buisness Layer to UI Layer

1. I used this code for my Data Access Layer, except that I changed it to VB.Net:
http://aspalliance.com/837_Implementing_a_Data_Access_Layer_in_C



2.--- To test the DAL code in that site, I created a Business Layer and have this in BAL:
Public Class Class1

    Public Function test() As String
        Dim tt As String
        Dim dbManager As IDBManager = New DBManager(DataProvider.SqlServer)
        dbManager.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString.ToString
        Try
            dbManager.Open()

            dbManager.ExecuteReader(CommandType.StoredProcedure, "QExample")
            While (dbManager.DataReader.Read)

                'System.Web.HttpContext.Current.Response.Write(dbManager.DataReader("MCode").ToString())

                tt = dbManager.DataReader("MCode").ToString()

            End While


        Catch ex As Exception
            System.Web.HttpContext.Current.Response.Write("Exception: " + ex.Message.ToString())


        Finally
            dbManager.CloseReader()
        End Try

        Return tt

    End Function


End Class

3. Then in my UI layer I have this:

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

         Dim test1 As New My_BLL.Class1
     
        Dim value As String
        value = test1.test

        Response.Write(value)


    End Sub


----- That only gets the last value of what the datareader read. How can I pass the entire datareader values from BAL to UI? I know I have defined the Functions's return value as String instead of a datareader....i want to keep the layers separate...I dont want UI to call the dbManager directly..

thanks for any input.
ASKER CERTIFIED SOLUTION
Avatar of ZeonFlash
ZeonFlash

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial