在删除所有信息之前备份数据库 [英] Backing up the DB before deleting all information

查看:43
本文介绍了在删除所有信息之前备份数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


我创建了一个数据库,用于为项目计算大量产品(物料清单)的成本和定价。我找不到设计数据库的方法,以便DIFFERENT项目的所有数据都可以驻留在同一个数据库中。 (即现在用户从一个带有干净DB,空表等的新项目开始......对于NEXT项目,他们将不得不删除所有内容,表等,以便他们可以从新项目开始)。


如何创建一个按钮来保存备份文件(使用当前数据库当前项目的名称),然后清除(删除)当前数据库的所有信息,以便用户可以从一个新项目开始???


有人能给我一些想法吗?

有没有一种简单的方法能够对与EACH项目相关的所有信息进行分类,以便所有内容都可以驻留在同一个数据库中????


谢谢,

Gilberto

解决方案

将项目表添加到您的设计中,然后在每个相关表中为projectID添加一个字段。这样,任何表的任何记录都可以属于单个项目。


但是,需要检查所有查询和代码,以确保它们只处理所需项目的数据。目前看来,我希望他们都能够理解所有记录都可以处理,因为它只知道一个项目。


看看规范化和表格结构,看看你是否能理解那些告诉你的内容。如果可以的话,对您和您的数据库有很大的好处。



在项目表中添加到您的设计中,然后添加一个字段projectID的每个相关表。这样,任何表的任何记录都可以属于单个项目。


但是,需要检查所有查询和代码,以确保它们只处理所需项目的数据。目前看来,我希望他们都能够理解所有记录都可以处理,因为它只知道一个项目。


看看规范化和表格结构,看看你是否能理解那些告诉你的内容。如果可以的话,对您和您的数据库有很大的好处。



感谢NeoPa。


我读过这篇文章,它非常有趣,我想我确实理解了它。然而,由于我对访问的经验有限,我决定不遵循项目。风格到现在。所以我需要的只是在当前项目完成后(可能持续数月)。用户只需按保存当前项目按钮并键入文件的名称即可。然后另一个按钮开始一个新项目,这将清除某些表格。


你能告诉我怎么做吗???到目前为止,我只使用按钮,但只使用默认选项。我不知道如何编码这些。


再次感谢,

Gilberto


嗨吉尔伯托,


这可能会变得复杂(取决于您的经验和理解)


您需要在Click中放置代码命令按钮的事件。此代码应该: -

  1. 创建当前项目的新副本;
  2. 清除各种元素(根据需要);
  3. 允许用户在必要时重命名对象;
  4. 保存新项目;
  5. 切换到新项目;
  6. 关闭现有项目。

要复制当前项目,需要使用Windows API,如下所示: -

发表声明: -

展开 | 选择 | Wrap | 行号

Hello

I created a DB for costing and pricing lots of products (Bill of Materials) for a "project". I couldnt find the way to design the DB so that ALL the data for DIFFERENT projects could reside on the same DB. (ie. right now users start with a new project with a clean DB, empty tables, etc...for the NEXT project they will have to delete everything, tables, etc so they could start with the new project).

How can create a button which will save a backup file (with the name of the current poject of the current DB) and then clear (delete) all the information of that current DB so that users could start with a new project???

Can anyone give me some ideas?
Is there a simple way to be able to classify all the information relating to EACH project so that everything could reside on the same DB ????

Thanks,
Gilberto

解决方案

Add in a project table to your design, then add a field in each related table for the projectID. That way, any record of any table can belong to an individual project.

All queries and code will need to be checked, however, to ensure they handle the data for the required project only. As it currently stands I expect they all work to the idea that all records can be processed as it only knows of one project.

Have a look in Normalisation and Table structures and see if you can understand what that''s telling you. There is great benefit to you and your databases if you can.


Add in a project table to your design, then add a field in each related table for the projectID. That way, any record of any table can belong to an individual project.

All queries and code will need to be checked, however, to ensure they handle the data for the required project only. As it currently stands I expect they all work to the idea that all records can be processed as it only knows of one project.

Have a look in Normalisation and Table structures and see if you can understand what that''s telling you. There is great benefit to you and your databases if you can.

Thanks NeoPa.

I have read the article, it is very interesting and i think i did understand it. However due to my limited experience with access i decided not to follow the "project" style by now. So what i need is just that after the current project is finished (which could last several months). The user could just press a save current project button and type the name for the file. Then another button to start a new project, that would CLEAR certain forms.

Could you tell me how to do this??? So far ive just worked with buttons but just with their default options. I dont know how to code these ones.

Thanks again,
Gilberto


Hi Gilberto,

This could get complicated (depends on your experience & understanding)

You will need to place code within the Click event of your command button. This code should:-

  1. Create the new copy of the current project;
  2. Clear the various elements (as required);
  3. Allow the user to rename objects, where necessary;
  4. Save the new project;
  5. Switch to the new project;
  6. Close the existing project.

To copy the current project, you need to the Windows API, as follows:-
Make a declaration:-

Expand|Select|Wrap|Line Numbers


这篇关于在删除所有信息之前备份数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆