473,386 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Multiple Properties

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
Nov 18 '05 #1
3 1433
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

Nov 18 '05 #2
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


Nov 18 '05 #3
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


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Max Weber | last post by:
Try to run the code below in a page. You will notice than when you switch the multiple attribute of the SELECT tag, only one option is displayed as selected although multiple options have ben...
1
by: intl04 | last post by:
Are there any problems with multiple user access to the same Access database on a shared network drive? I have 'shared' chosen for 'default open mode'. As for the record locking properties, I...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
10
by: Kishor | last post by:
Hi, I am looking for the solution to my problem. this is related to inheritance (Inheriting properties of base class in multiple quantity) . I am writing code in VB.net language, I am having two...
0
by: blackdevil1979 | last post by:
Hello, > "In COM, multiple inheritance between interfaces is not supported. However, by using the derived members capability, multiple inheritance can be simulated."..MSDN Library I have...
8
by: **Developer** | last post by:
I have a control called MyPanel that inherits from Panel. Also a control called MyRTB that inherits from RichTextBox. They are used on a form as follows: MyPanel in on the form and MyRTF is...
4
by: beatdream | last post by:
I am designing a database to handle different kinds of products ... and these products can have different properties...for example, a trouser can be specified by the width, length, color, and other...
47
by: Larry Smith | last post by:
I just read a blurb in MSDN under the C++ "ref" keyword which states that: "Under the CLR object model, only public single inheritance is supported". Does this mean that no .NET class can ever...
6
by: =?Utf-8?B?UXVhbiBOZ3V5ZW4=?= | last post by:
I am trying to create a generics class with multiple constrains, as follows: public class KeyHandler<Twhere T : TextBoxBase, ComboBox When I try that, the compiler would complain: The class...
3
by: johanatan | last post by:
When I first heard about these new features, I was very excited as it would have (if implemented as I had expected) rendered mimicking multiple inheritance almost painless in C#. Unfortunately,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.