berneiceqdarsowq
New Member
Hi, I am learning to build a small three-tiered ASP application. I have a UI.ASPX, BusinessObj.VB and DataObject.VB. My problem is after I retrieved a record in DataObject.VB, how do I pass the retrieved Data from DataObject.VB to BusinessObj.VB, and back to UI.ASPX ? I am hoping to retrieve the DataObject properties in UI.ASPX but dun know how, and is it the best way ?<BR><BR>Here is an Example of how I have coded which is not really correct. <BR><BR>DataOBj.VB:<BR><BR> Public Class DataLayerObj_Categories<BR><BR> Private sCategoryName As String<BR> Private sCategoryDescription As String<BR><BR> Public Property CategoryName() As String<BR> Get<BR> Return sCategoryName<BR> End Get<BR> Set(ByVal Value As String)<BR> sCategoryName = Value<BR> End Set<BR> End Property<BR><BR> Public Property CategoryDescription() As String<BR> Get<BR> Return sCategoryDescription<BR> End Get<BR> Set(ByVal Value As String)<BR> sCategoryDescription = Value<BR> End Set<BR> End Property<BR><BR> Public Function RetrieveRecord(ByVal ID As Integer)<BR> Dim myConnection As SqlConnection<BR> Dim myCommand As SqlCommand<BR> Dim myDataReader As SqlDataReader<BR><BR> myConnection = New SqlConnection(sConnStr)<BR> myConnection.Open()<BR><BR> myCommand = New SqlCommand("select CategoryName, CategoryDescription from Categories Where CategoryID = " & ID, myConnection)<BR><BR> myDataReader = myCommand.ExecuteReader()<BR><BR> CategoryName = myDataReader.Item("CategoryName")<BR> CategoryDescription = myDataReader.Item("CategoryDescription")<BR><BR> myDataReader.Close()<BR> myConnection.Close()<BR> End Function<BR><BR> End Class<BR><BR>--------------------------------------------------------------<BR><BR>BusinessObj.VB:<BR><BR> Public Class BusinessObj_Categories<BR><BR> Private Data As DataLayerObj_Categories<BR><BR> Public Function RetrieveRecord()<BR> Return Data.RetriveRecord()<BR> End Function<BR><BR> End Class<BR><BR>--------------------------------------------------------------<BR><BR>UI.ASPX:<BR> Dim Bus As BusinessObj_Categories<BR> Bus = New BusinessObj_Categories()<BR> Call Bus.RetrieveRecord<BR> <BR>'??? Dun know how to retrieve properties in DataObject to get the CategoryName and CategoryDescription<BR><BR>If you could show me some sample codes would be very nice
<BR><BR>Thanks<BR>Matthew
