在Windows中基于日期搜索deta使用文件概念进行复制? [英] Searching of deta based on date in windows Apllication using Files concept ?

查看:66
本文介绍了在Windows中基于日期搜索deta使用文件概念进行复制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

日常约会将存储为一个文件,因此如果它是Windows应用程序会更好,现在如果我单击搜索"按钮并在文本框中输入日期,则该日的约会应显示在文件中概念.并且未使用任何外部数据库(例如sqlserver,oracle等).

解决方案

您要执行的操作非常复杂-至少可以正确执行.
问题是约会"改变了:日期改变了,时间改变了,它们被取消了,它们被添加了,所以如果您将它们存储在一个基于文本的文件中,则会遇到很多问题:文件必须重新存储.每次更改后都完全写好.此外,还会增加其他并发症:
1)必须先将所有数据从文本转换为内部值,例如日期,字符串等,然后才能使用它们.
2)您必须自己进行排序和搜索.
3)记录长度不是固定的(或者不可能是固定长度的).
4)您必须自己处理分隔符-并在它们出现在要保存的值中时应对它们.
例如,如果您确定值之间用逗号分隔,当约会列表中的条目不时出现在我的待办事项列表中时,该怎么办? 5)如果文件损坏-例如,如果有人手动编辑它,则必须处理数据恢复.

除非这是家庭作业,并且明确指定为使用文本文件",否则我不会这样做-我将使用某种形式的数据库-SQLCE非常简单,可以作为部署的一部分与您的应用一起安装. blockquote>

Day to day appointments would be stored n a file so it would be better if it is a windows app and now if i click on the search button and give a date in the textbox then the appointments on that day should be displayed in files concept. and not used any external database like sqlserver,oracle etc......

解决方案

What you are trying to do is quite complex - at least to do correctly.
The problem is that "appointments" change: the date changes, the time changes, they get cancelled, they get added, so if you are storing them in a text based file then you have a lot of problems: the file has to be re-written completely after each change. In addition, you add other complications:
1) All data needs to be converted from text to internal values such as dates, strings, etc before you can use them.
2) You will have to handle sorting and searching yourself.
3) Records will not be fixed length (or are unlikely to be at any rate).
4) You will have to handle separator characters yourself - and cope with them when they appear in a value to be saved.
For example, if you decide that values are separated by commas, what do you do when an entry in your appointments list is for "Buy oil, groundnut" as appears in my to-do list from time to time?
5) You will have to handle data recovery if the file becomes corrupted - for example if someone edits it by hand.

Unless this is homework, and clearly specified as "use a text file" then I would not do that - I would use a database of some form - SQLCE is pretty simple and can be installed with your app as part of the deployment.


这篇关于在Windows中基于日期搜索deta使用文件概念进行复制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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