Click here to Skip to main content
14,330,689 members
Rate this:
Please Sign up or sign in to vote.
hello

i have a simple payroll application written in visual basic 2010 express. i have created a database (called db.mdf) within this IDE. The type of database is Microsoft SQL Server Database File (SqlClient). the data is displayed in form by the help of a data grid view.

now my challenge is: at the end of the month the main table with all his content ( id, name, nr of worked hours) should be cloned and renamed with the name of current month.

i have been searched the web for 2 weeks and i didn`t find a workable way.
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

Why don't you create a single secondary table that contains the data form all previous months rather than creating an endless series of identical tables. That way you can insert the month data into the archive data table which will have one extra identifying field (perhaps year/month like 201007, 201008 etc) and then delete those records from the main table.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

sounds good. create another column to host the year and month at the edge of curent table.

but if i will do like this i think it would be dificult to create reports with report viwer control.
   
Comments
tiggerc 3-Jul-10 13:15pm
   
Should be relatively simple, you could just store the entry date in the last field using getdate(), then using a query like this

SELECT * FROM TBL_ACCOUNTS
WHERE ENTRY_DATE BETWEEN CDATE('01-06-2009') AND CDATE('30-06-2009') ORDER BY ENTRY_DATE

that may work it does for me anyway, but i use SQL Server
R. Giskard Reventlov 4-Jul-10 4:39am
   
Don't respond with an answer; use comments to reply to posts.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100