Hi Robson,
Here is a short example, it doesn't have any exception handling. Good luck!
Ken.
Public Class Person
Private mstrFirstName, mstrLastName As String
Private mintAge as Integer
Public Property FirstName() As String
Get
Return mstrFirstName
End Get
Set(ByVal Value As String)
mstrFirstName = Value
End Set
End Property
Public Property LastName() As String
Get
Return mstrLastName
End Get
Set(ByVal Value As String)
mstrLastName = Value
End Set
End Property
Public Property Age() As Integer
Get
Return mintAge
End Get
Set(ByVal Value As Integer)
mintAge = Value
End Set
End Property
Public Sub FillPerson(ByVal objDS As DataSet)
Dim objDR As DataRow
objDR = objDS.Tables(0).Rows(0)
mstrFirstName = CStr(objDR("FirstName"))
mstrLastName = CStr(objDR("LastName"))
mintAge = CInt(objDR("Age"))
End Sub
End Class
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
"Robson Carvalho Machado" <Ro*******************@discussions.microsoft.com >
wrote in message news:8A**********************************@microsof t.com...
Hi Ken,
Can you send me an example?
Regards
Robson Machado
"Ken Dopierala Jr." wrote:
Hi,
What I do is create a Fill() function in my class. This function
receives a dataset and reads the first row and fills my class' properties. In some
classes I overload the Fill() function to also accept a specific row
number, the function then uses this row to fill the properties. I don't usually
have the class itself run the query, I create a data access layer that
runs the query. I then take the dataset returned from the data access layer
and pass that to the Fill() function of my class. Good luck! Ken.
--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
"Robson Carvalho Machado"
<Ro*******************@discussions.microsoft.com > wrote in message
news:64**********************************@microsof t.com... Dear friends,
How can I create a Class and have multiple I/O porperties.
Example:
At my ASPX.VB I would like to pass
test.ID = "G25"
test.country = "US"
and receive the processed data
response.write test.name
response.write test.address
response.write test.zipcode
Description of what test class need to do:
Public Class test
... I need to pass an ID to be processed by SQL Query
... that is something like this: "Select name,address,zipcode from
customers where id=" & ID & " and country=" & country
...and need to return to my ASPX.VB the result as properties:
... test.name = dbread("name")
... test.address = dbread("address")
... test.zipcode = dbread("zipcode")
end Class