|
 |
activex_data_objects thread: Using the recordset of any particular form in a class module(Visual Basic)
Message #1 by "Krishna Vaddadi" <krishnavaddadi@y...> on Wed, 14 Nov 2001 09:24:58
|
|
Hi helpers
well i am rather stuck with a problem associated with so called OOP
technology programing in VISUAL BASIC
I have a general function in a COM+ component which retireves the record
set in the form of disconnected recordset for any SQL query as input.
Now for this recordset how should i tackle in the client end class module
for navigational or update processes.
I mean i now pass this record set to the client class module and then if
my toolbar "Next" (in my mdi form) button is pressed then the record
should scroll to the next record for any particular active form present in
mdi.
For this currently i am passing my recordset and form name as parameters
but this does not seem to work properly and on the contrary is making my
code extremely complicated
What should be my approach??
the reasoning would be implied for any further operations also since i
know even in update or save i will be facing the same difficulty, since
then i will have to assign the text control values back to the recordset
for updating
This makes me feel traditional 2 tier was far more simple than this n-tier
model:(
Message #2 by "Richard Maly" <maly@m...> on Wed, 14 Nov 2001 09:38:58
|
|
You have just hit on a problem that is a huge subject (and the question is
probably best suited to the pro_vb list). I am afraid the only answer is
to do some research (Wrox do a couple of books that have methodology you
can use look at Lhokta's books), However below is a very brief suggection
as to how you could do this. But there is no right or wrong ways to do
this, just a mixture of varying degrees of appropriateness, and
efficiency.
What you need to do is create a database tier, this will create your
recordset
Next is the business (object) layer this will probably have a collection
of individual objects that have been created using the recordset. These
objects can then be passed to the form one at a time when needed.
> Hi helpers
>
> well i am rather stuck with a problem associated with so called OOP
> technology programing in VISUAL BASIC
>
> I have a general function in a COM+ component which retireves the record
> set in the form of disconnected recordset for any SQL query as input.
>
> Now for this recordset how should i tackle in the client end class
module
> for navigational or update processes.
>
> I mean i now pass this record set to the client class module and then if
> my toolbar "Next" (in my mdi form) button is pressed then the record
> should scroll to the next record for any particular active form present
in
> mdi.
> For this currently i am passing my recordset and form name as parameters
> but this does not seem to work properly and on the contrary is making my
> code extremely complicated
> What should be my approach??
>
> the reasoning would be implied for any further operations also since i
> know even in update or save i will be facing the same difficulty, since
> then i will have to assign the text control values back to the recordset
> for updating
>
> This makes me feel traditional 2 tier was far more simple than this n-
tier
> model:(
Message #3 by KRISHNA VADDADI <krishnavaddadi@y...> on Wed, 14 Nov 2001 01:48:29 -0800 (PST)
|
|
Hi Richard Maly
Thanks, I guessed it so and so did i say it in my last
line. But then the problem comes down to the
efficiency of code written to tackle these type of
situations.
--- Richard Maly <maly@m...> wrote:
> You have just hit on a problem that is a huge
> subject (and the question is
> probably best suited to the pro_vb list). I am
> afraid the only answer is
> to do some research (Wrox do a couple of books that
> have methodology you
> can use look at Lhokta's books), However below is a
> very brief suggection
> as to how you could do this. But there is no right
> or wrong ways to do
> this, just a mixture of varying degrees of
> appropriateness, and
> efficiency.
>
> What you need to do is create a database tier, this
> will create your
> recordset
>
> Next is the business (object) layer this will
> probably have a collection
> of individual objects that have been created using
> the recordset. These
> objects can then be passed to the form one at a time
> when needed.
>
>
>
> > Hi helpers
> >
> > well i am rather stuck with a problem associated
> with so called OOP
> > technology programing in VISUAL BASIC
> >
> > I have a general function in a COM+ component
> which retireves the record
> > set in the form of disconnected recordset for any
> SQL query as input.
> >
> > Now for this recordset how should i tackle in the
> client end class
> module
> > for navigational or update processes.
> >
> > I mean i now pass this record set to the client
> class module and then if
> > my toolbar "Next" (in my mdi form) button is
> pressed then the record
> > should scroll to the next record for any
> particular active form present
> in
> > mdi.
> > For this currently i am passing my recordset and
> form name as parameters
> > but this does not seem to work properly and on the
> contrary is making my
> > code extremely complicated
> > What should be my approach??
> >
> > the reasoning would be implied for any further
> operations also since i
> > know even in update or save i will be facing the
> same difficulty, since
> > then i will have to assign the text control values
> back to the recordset
> > for updating
> >
> > This makes me feel traditional 2 tier was far more
> simple than this n-
> tier
> > model:(
>
> ---
> You are currently subscribed to activex_data_objects
> as: krishnavaddadi@y...
> $subst('Email.Unsub')
>
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
Message #4 by "Jake Sturm" <jake_sturm@y...> on Wed, 14 Nov 2001 18:12:38 +0800
|
|
I think I know the answer to your problem. Now that you've made a COM+
component that retrieves recordsets from your recordsource, you should now
create a client-side class module that encapsulates the retrieved recordset
and globally instantiate your class so that any navigation done in your
recordset (now a class) is reflected on the forms within the MDI.
Joseph
Also, try reading WROX' VB6 UML Design and Developement, this book will help
you a lot
----- Original Message -----
From: "Krishna Vaddadi" <krishnavaddadi@y...>
To: "ActiveX_Data_Objects" <activex_data_objects@p...>
Sent: Wednesday, November 14, 2001 9:24 AM
Subject: [activex_data_objects] Using the recordset of any particular form
in a class module(Visual Basic)
> Hi helpers
>
> well i am rather stuck with a problem associated with so called OOP
> technology programing in VISUAL BASIC
>
> I have a general function in a COM+ component which retireves the record
> set in the form of disconnected recordset for any SQL query as input.
>
> Now for this recordset how should i tackle in the client end class module
> for navigational or update processes.
>
> I mean i now pass this record set to the client class module and then if
> my toolbar "Next" (in my mdi form) button is pressed then the record
> should scroll to the next record for any particular active form present in
> mdi.
> For this currently i am passing my recordset and form name as parameters
> but this does not seem to work properly and on the contrary is making my
> code extremely complicated
> What should be my approach??
>
> the reasoning would be implied for any further operations also since i
> know even in update or save i will be facing the same difficulty, since
> then i will have to assign the text control values back to the recordset
> for updating
>
> This makes me feel traditional 2 tier was far more simple than this n-tier
> model:(
>
jake_sturm@y...
$subst('Email.Unsub')
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Message #5 by KRISHNA VADDADI <krishnavaddadi@y...> on Wed, 14 Nov 2001 01:57:59 -0800 (PST)
|
|
Hi Jake Sturm
Thats ok i believe i need to accentuate the point that
i am facing problem in the client module and not the
server module
Now in this client module how is my class going to
recognise which form's control need to display which
recordset value?? i mean when i press "Next" in my mdi
toolbar then how is the activeform going to get with
this current recordset? and for which control this
value need to be displayed?? i mean every form has
different controls on it and if i try to display thru
count then there is a high probability that the index
of recordset value not matching the count order
conreol on the form
I hope i am being clear rather than messing it up more
:(
--- Jake Sturm <jake_sturm@y...> wrote:
> I think I know the answer to your problem. Now that
> you've made a COM+
> component that retrieves recordsets from your
> recordsource, you should now
> create a client-side class module that encapsulates
> the retrieved recordset
> and globally instantiate your class so that any
> navigation done in your
> recordset (now a class) is reflected on the forms
> within the MDI.
>
> Joseph
>
> Also, try reading WROX' VB6 UML Design and
> Developement, this book will help
> you a lot
>
> ----- Original Message -----
> From: "Krishna Vaddadi" <krishnavaddadi@y...>
> To: "ActiveX_Data_Objects"
> <activex_data_objects@p...>
> Sent: Wednesday, November 14, 2001 9:24 AM
> Subject: [activex_data_objects] Using the recordset
> of any particular form
> in a class module(Visual Basic)
>
>
> > Hi helpers
> >
> > well i am rather stuck with a problem associated
> with so called OOP
> > technology programing in VISUAL BASIC
> >
> > I have a general function in a COM+ component
> which retireves the record
> > set in the form of disconnected recordset for any
> SQL query as input.
> >
> > Now for this recordset how should i tackle in the
> client end class module
> > for navigational or update processes.
> >
> > I mean i now pass this record set to the client
> class module and then if
> > my toolbar "Next" (in my mdi form) button is
> pressed then the record
> > should scroll to the next record for any
> particular active form present in
> > mdi.
> > For this currently i am passing my recordset and
> form name as parameters
> > but this does not seem to work properly and on the
> contrary is making my
> > code extremely complicated
> > What should be my approach??
> >
> > the reasoning would be implied for any further
> operations also since i
> > know even in update or save i will be facing the
> same difficulty, since
> > then i will have to assign the text control values
> back to the recordset
> > for updating
> >
> > This makes me feel traditional 2 tier was far more
> simple than this n-tier
> > model:(
> >
> > ---
> > You are currently subscribed to
> activex_data_objects as:
> jake_sturm@y...
> $subst('Email.Unsub')
>
>
>
>
_________________________________________________________
>
> Do You Yahoo!?
>
> Get your free @yahoo.com address at
> http://mail.yahoo.com
>
>
>
>
> ---
> You are currently subscribed to activex_data_objects
> as: krishnavaddadi@y...
> $subst('Email.Unsub')
>
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
Message #6 by "Jake Sturm" <jake_sturm@y...> on Fri, 16 Nov 2001 09:03:36 +0800
|
|
I see, your problem is how to bind those controls to the recordset's values,
well, there are 2 solutions to your problem, you can either use an ADO
control and point it to your disconnected recordset or have a data-source
class module that encapsulates the recordset and point each control's
datasource to your made class.
----- Original Message -----
From: "KRISHNA VADDADI" <krishnavaddadi@y...>
To: "ActiveX_Data_Objects" <activex_data_objects@p...>
Sent: Wednesday, November 14, 2001 5:57 PM
Subject: [activex_data_objects] Re: Using the recordset of any particular
form in a class module(Visual Basic)
> Hi Jake Sturm
> Thats ok i believe i need to accentuate the point that
> i am facing problem in the client module and not the
> server module
> Now in this client module how is my class going to
> recognise which form's control need to display which
> recordset value?? i mean when i press "Next" in my mdi
> toolbar then how is the activeform going to get with
> this current recordset? and for which control this
> value need to be displayed?? i mean every form has
> different controls on it and if i try to display thru
> count then there is a high probability that the index
> of recordset value not matching the count order
> conreol on the form
> I hope i am being clear rather than messing it up more
> :(
>
> --- Jake Sturm <jake_sturm@y...> wrote:
> > I think I know the answer to your problem. Now that
> > you've made a COM+
> > component that retrieves recordsets from your
> > recordsource, you should now
> > create a client-side class module that encapsulates
> > the retrieved recordset
> > and globally instantiate your class so that any
> > navigation done in your
> > recordset (now a class) is reflected on the forms
> > within the MDI.
> >
> > Joseph
> >
> > Also, try reading WROX' VB6 UML Design and
> > Developement, this book will help
> > you a lot
> >
> > ----- Original Message -----
> > From: "Krishna Vaddadi" <krishnavaddadi@y...>
> > To: "ActiveX_Data_Objects"
> > <activex_data_objects@p...>
> > Sent: Wednesday, November 14, 2001 9:24 AM
> > Subject: [activex_data_objects] Using the recordset
> > of any particular form
> > in a class module(Visual Basic)
> >
> >
> > > Hi helpers
> > >
> > > well i am rather stuck with a problem associated
> > with so called OOP
> > > technology programing in VISUAL BASIC
> > >
> > > I have a general function in a COM+ component
> > which retireves the record
> > > set in the form of disconnected recordset for any
> > SQL query as input.
> > >
> > > Now for this recordset how should i tackle in the
> > client end class module
> > > for navigational or update processes.
> > >
> > > I mean i now pass this record set to the client
> > class module and then if
> > > my toolbar "Next" (in my mdi form) button is
> > pressed then the record
> > > should scroll to the next record for any
> > particular active form present in
> > > mdi.
> > > For this currently i am passing my recordset and
> > form name as parameters
> > > but this does not seem to work properly and on the
> > contrary is making my
> > > code extremely complicated
> > > What should be my approach??
> > >
> > > the reasoning would be implied for any further
> > operations also since i
> > > know even in update or save i will be facing the
> > same difficulty, since
> > > then i will have to assign the text control values
> > back to the recordset
> > > for updating
> > >
> > > This makes me feel traditional 2 tier was far more
> > simple than this n-tier
> > > model:(
> > >
> > > ---
> > > You are currently subscribed to
> > activex_data_objects as:
> > jake_sturm@y...
> > $subst('Email.Unsub')
> >
> >
> >
> >
> _________________________________________________________
> >
> > Do You Yahoo!?
> >
> > Get your free @yahoo.com address at
> > http://mail.yahoo.com
> >
> >
> >
> >
> > ---
> > You are currently subscribed to activex_data_objects
> > as: krishnavaddadi@y...
> > $subst('Email.Unsub')
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Find the one for you at Yahoo! Personals
> http://personals.yahoo.com
>
jake_sturm@y...
$subst('Email.Unsub')
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
Message #7 by KRISHNA VADDADI <krishnavaddadi@y...> on Thu, 15 Nov 2001 20:39:00 -0800 (PST)
|
|
Hi Jake Sturm
Thanks for the tip
i think even i am in the same lines i am actually
doing it like this as explained below :
1.) For navigational purposes: eg say for move
previous:(i wrote this in my client end class module
Public Sub ShowPreviousRecord(ByVal rsPreviousRecord
As ADODB.Recordset)
If rsPreviousRecord.RecordCount > 0 Then
rsPreviousRecord.MovePrevious
If rsPreviousRecord.BOF Then
Call ShowMessage("First Record")
rsPreviousRecord.MoveFirst
End If
End If
End Sub
This is irrespective of the active form and is going
to previous record
Now comes showing these values on the respective form
whichever is active
Public Sub ShowValuesOnForm(ByVal rsShowRecords As
ADODB.Recordset, ByRef frmName As Form)
Select Case frmName.Name
Case "frmCompanyMaster"
frmName.txtCompanyCode.Text
rsShowRecords("CompanyCode")
frmName.txtDescription.Text
rsShowRecords("Description")
case "frmContractMaster"
OTHER RELATED CONTROLS ON THIS FORM...
case OTHER FORM
.....
End Select
End Sub
Here i even pass the form name and depending on the
form i know which controls are there so i directly
assign these record set values to this form
same logic i have applied while modifying values
but the assigning values are reversed, I felt this is
the simplest to follow and so did i do it, any
suggestions on this are whole heartedly welcome :)
Thanks
Krishna
__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com
|
|
 |