存储数据,请帮忙! [英] Storing Data Please Help!

查看:64
本文介绍了存储数据,请帮忙!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去的几年中,我建立了一个内部excel程序来帮助我们进行订购和管理.随着程序的巨大发展,它变得非常缓慢!因此,我开始创建一个.net程序来完成工作!到目前为止,我已经写了很多程序,非常好.我有一个大问题.

我的excel程序为每个客户创建了一个新文件(另存为....真正简单),并放置在共享云文件夹中的creators文件夹中.

我需要在新的.net程序中存储很多信息,但是它必须基于每个客户.

我目前有需要存储在My.Settings
中的数据
我需要将这些数据保存到外部文件中,并保存在我设置的位置

然后,它将通过云文件共享发送到我的其他计算机,他们可以在其中打开文件并使用该文件执行所需的操作!

我必须这样做,因为有时我在野外无法上网,并且当我收到互联网时它会自动发送!


我希望我能弄清楚,但我做得不好.
我需要比我聪明的人的帮助!

谢谢Code Project!

Over the past few years, I have built a in house excel program to help us with our ordering and management. With the huge growth of the program it has gotten very slow! So I took on the job to create a .net program to get the job done! I have written a lot of the program and so far, so good. I just have one big problem.

My excel program created a new file for each customer (save as .... real simple) and placed into the creators folder that was on a shared cloud folder.

I need to store a lot of info in the new .net program, but it has to be on a customer by customer basis.

I currently have the data I need stored in My.Settings

I need to get this data to a external file, saved in a location that I set

It will then be sent via cloud file share to my other computers where they can open the file and do what is needed with it!

I have to do it this way because sometimes I am in the field with no internet access, and it automatically sends when I receive internet!


I wish I can figure this out, but I am not doing so well.
I need the help from people far smarter than I!

Thank you Code Project!

推荐答案

将文件保存到任何位置实际上非常简单.
您可以在 System.IO命名空间 [ System.Directory [ ^ ].
要对文件执行相同的操作,可以使用 System.File [ ^ ]和System.FileStream [ [基本本能:使用Streams和VB.NET进行I/O编程 [ ^ ].
当写入某个目录时,您当然应该确保您具有足够的读/写访问权限,否则将引发异常. FileIOPermission [序列化 [序列化对象. [
Saving a file to any location is actually quite simple.
Most of it you can find in the System.IO Namespace[^].
To check if directories exist or to create new ones you can use System.Directory[^].
For doing the same with files you can use System.File[^] and System.FileStream[^].
To get more familiar with Stream[^]s (such as FileStream) you can Google around. One article I found for you: Basic Instincts: Programming I/O with Streams and VB.NET[^].
When writing to a certain directory you should of course make sure you have sufficient read/write access or an exception will be thrown. FileIOPermission[^] helps in this regard.

When the above methods do not suffice I suggest you read up on Serialization[^] and Serializing Objects.[^].

Hope it helps :)
Good luck!


首先,如果您要继续使用Excel,那不只是严重的事情.这种方法给您带来了很多麻烦,但仍然使您无法使用专有的非免费产品.我可以想像两种相反的方法:您可以使用一些家庭支持的存储系统(根本不是第三方),也可以使用基于RDBMS和客户端-服务器的解决方案(但它仍然可以是免费的). Excel的解决方案是最差的一种.它并非设计为数据库,它不提供集成,不支持.认真对待并获得数据库解决方案.

您有很多选择.请参阅:
http://en.wikipedia.org/wiki/Comparison_of_databases [ http://en.wikipedia.org/wiki/Ado.net [ http://msdn2.microsoft.com/en-us/library/aa286484.aspx [ ^ ].

另请参见此CodeProject文章:为初学者使用ADO.NET [ http://msdn.microsoft.com/en-us/library/ms733127.aspx [ ^ ].

我在过去的解决方案中主张采用这种方法:
如何在我的表单应用程序? [ ^ ],
创建属性文件... [反序列化json字符串数组 [
First, if you are going to keep using Excel, I would say, this is not just serious. This approach gives you enough trouble but still keeps you locked with a proprietary, non-free product. I can imagine two opposite approaches: you could use some home-backed storage system (not 3rd-party at all) or the solution based on some RDBMS and client-server (but it still can be free). The solution with Excel is the worse one. It is not designed to be a database, it provides no integration, not support. Do be serious and get to database solution.

You have a good deal of choices. See: http://en.wikipedia.org/wiki/Comparison_of_databases[^].

With VB.NET, you can use ADO.NET. See:
http://en.wikipedia.org/wiki/Ado.net[^],
http://msdn2.microsoft.com/en-us/library/aa286484.aspx[^].

See also this CodeProject article: Using ADO.NET for beginners[^].

Still, you can use files for storing and loading data models with limited volume of data (such as configurations). This approach is good because you don''t need any 3rd-party component. The best way is using Data Contract. See:
http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].

I advocate this approach in my past solutions:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating property files...[^],
deseralize a json string array[^].

—SA


这篇关于存储数据,请帮忙!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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