exposing datasets

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey all,

is it ok to make a dataset public property? ok to make a dataset a public
variable? which one is better, if any? why?

thanks,
rodchar
 
Rodchar,

Depends how you use it, however in the way I understand now from you will it
more often be something as an own inherited dataset class itself. And than a
start for a typed dataset.

\\\
Class MyDataset
Inherits Dataset
////

However tell something more.

Cor
 
i'm using it in a single business class where i instantiate it and expose it
as a public property from that class.
 
Rodchar,

When it is in a class there is no reason to use a property.

However, until now do I use it for ever. I asked often in this newsgroup"Can
anybody give me a reason". I never have seen a *rational* reason for that.

Cor
 
So what if another class needs the dataset, should I just make the dataset a
public variable instead of property?
 
Rodchar,

I hope you become not agry however it sounds so strange for me.

A datatable is a class that describes a kind of entity and has methods and
events for that (it reflects a database table). A dataset describes even a
collection of datatables and can reflects a complete database..

Now becomes dataset a property of a class. And therefore I become confused.

Can you show some code of that class.

Cor
 
Public Class Customer
Dim oDataAccessLayer As DataAccessLayer
Dim _ds As dsNorthwind
Dim _dr As dsNorthwind.CustomersRow

Public Sub New()
oDataAccessLayer = New DataAccessLayer
_ds = New dsNorthwind
End Sub

Public Property oDsNorthwind()
Get
Return _ds
End Get
Set(ByVal Value)
_ds = Value
End Set
End Property

Public ReadOnly Property CustomerID() As String
Get
Return _dr.CustomerID
End Get
End Property


Public Property CompanyName() As String
Get
Return _dr.CompanyName()
End Get
Set(ByVal Value As String)
_dr.CompanyName = Value
End Set
End Property

Public Property ContactName() As String
Get
Return _dr.ContactName
End Get
Set(ByVal Value As String)
_dr.ContactName = Value
End Set
End Property

'Retrieve all customers
Public Function RtvAllCustomers() As dsNorthwind
oDataAccessLayer.RetrieveAllCustomers(_ds)
Return _ds
End Function

'Create single customer
Public Sub RtvCustomer(ByVal ID As String)
_dr = _ds.Customers.NewCustomersRow
oDataAccessLayer.RetrieveCustomer(ID, _dr)
End Sub
'Retrieve single customer
'Update single customer
'Delete single customer
End Class

The dataset contains the orders table as well.
 
Back
Top