Datatable Advice

  • Thread starter Thread starter Vayse
  • Start date Start date
V

Vayse

Hi
This is a project I'm doing in my own time, and I'm wondering what the best
method is.
This app is to calculate training on players in an online football game.
Each player has several skills, but for simplicity, lets just say 3 skills -
Scoring, Midfield, Defending. Each week, one skill is trained.
So if Scoring is trained, all Players increase their Scoring skill by a
number. For the example, lets assume the number is one
If TraningType = Scoring, then PlayerTraining.Scoring += 1

I have 3 tables - Players, PlayerTraining, Training.

PLAYERS
PlayerID
PlayerName
Age

PLAYER_TRAINING
PT_WeekID
PT_PlayerID
Scoring
Midfield
Defending

TRAINING
WeekID
TrainingType


So, I was going to write a function to calculate training for a range of
weeks. Something like this, where dtPlayerTraining and dtFilter are both
datatables.

Fill dtPlayerTraining (lStartWeek , lEndWeek)
For iWeekID = lStartWeek to lEndWeek
Fill dtFilter with all players training for iWeekID
Pass dtFilter to a training object. This object works out how much to
increase the appropiate skill in dtFilter
Merge dtFilter back into dtPlayerTrainig
Next
Update dtPlayerTraining

Is this the most efficient way? Any advice appreciated.

Thanks
Vayse
 
It's really a function of your database engine (JET/XML/ and skill level,
how much data you plan to process and whether or not the database is
accessible locally or over the net.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
Hi Vayse,

In my opinion, you needn't pull data into DataTable and do the summary. You
can utilize the database engine to do the summary. It will be much faster
at the database level than you do the accumulation with your own code.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Well, the data will be stored locally in an access database.
I guess my main question is which is better/faster: to update the dataviews,
and merge back, with one large update at the end. Or to update in smaller
blocks for each week.
As I said, its not a work project, so efficiency isn't that important. But
I'd like to get it right!
 
Back
Top