Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: VB OOP A & D Question


Message #1 by Matt.Brook@p... on Fri, 21 Dec 2001 20:07:37
I'm reposting this message because I've just tried to reread and had 
problems understanding it myself!  Here again, with corrections:

Merry Xmas everyone,

Kardyin, I'd firstly like to say what a great bloke I think you are.  I 
mean the effort you have put into anwersing this question (not to mention 
the earlier one from Sam) is incredible.  Secondly, I like to say, darn 
it! by the time I read the digest the few questions that I could have 
answered well, get answered by you so comprehensively that there's very 
little left to add! :-)

Anyway, back on subject.  I agree with your analysis here.  When I have 
this situation, I use classes which have properties for collecting the 
object's information and methods wrapping the SPs used to enter the 
information into the database.  

To get the information out of the db, I generally use a reporting class. 
It has properties used as the input parameters to the SPs which return the 
relevent recordsets, before they are stuffed into a grid (all fairly 
humdrum).  I'm sure there is a better way, and if so I'd love to hear 
about it

Matt, a simple example of what I mean for Agent and Product.  You will 
obviously need to add it the Product sales info....

[ClsAgent]
>>Properties
-Name
-Location
etc

>>Methods
-AddToDB (wrapper for SP, automatically assigns ID)
-DeleteFromDB (wrapper for SP)

[ClsProduct]
>>Properties
-Name
-Type
-Manufacturer
etc

>>Methods
-AddToDB(Product as string, Type as string, Manufacturer as string)
<wrapper for SP call, automatically assigns ID>
-DeleteFromDB <wrapper for SP call>

[ClsReport]
>>Properties
-Agent, e.g. <list all>, <aggregate> or <individual> i.e. 'Mr Blonde'
-Product, e.g. <list all>, <aggregate> or <individual> i.e. 'Razor'
-Date1
-Date2, i.e. range of dates to report on
-DateType, e.g. 0 = daily, 1 = weekly, 2 = monthly

>>Methods <which wrap SP calls>
-ReportByAgent(Agent as string, Date1 as Date, Date2 as Date, DateType as 
integer) as ADODB.Recordset
-ReportByProduct(Product as string, Date1 as Date, Date2 as Date, DateType 
as integer) as ADODB.Recordset
-ReportByAgentByProduct (Agent as string, Product as string, Date1 as 
Date, Date2 as Date, DateType as integer) as ADODB.Recordset 
<cross tabulation>
etc

If you need any help build the SPs then repost (maybe better in 
vbpro_databases)

HTH,
andy
>

  Return to Index