C# App 数据库 - 小型、多种表单的应用程序 - 表单需要通过数据库交换数据
为了给您一些背景知识,我正在从事的项目是扑克锦标赛经理。它使用两种形式 - 主形式将显示整个锦标赛的信息,例如剩余玩家、玩家姓名、赌注、支付结构、剩余时间等;另一种形式将用作“设置”形式。这两种形式都已构建并正在运行,但我正在努力让它们相互共享数据。
我想要做的是加载设置表单,选择配置锦标赛的选项,然后单击“保存”将我的所有选项分配给变量,然后将这些变量写入某种数据库(我是新手)数据库设计,我还没有在 Visual Studio 中使用任何数据库对象还)。然后主窗体可以读取DB并显示相关数据。我看到的好处是可以保存锦标赛设置以供将来使用,并且可以随着时间的推移累积玩家统计数据。
我需要创建什么类型的数据库对象来存储这些数据,以及如何打开连接等并将数据写入数据库?
To give you some background, the project I am working on is a poker tournament manager. It uses two forms - the main form will display information throughout the tournament, such as players remaining, player names, stakes, payout structure, time left etc; and the other form will be used as a 'setup' form. Both of these forms are built and working, but I am struggling to get them to share data with each other.
What I want to do is load the setup form, select my options for configuring the tournament, and then clicking 'save' will assign all of my options to variables and then write these variables to a database of some kind (I'm new to DB design and I haven't used any DB objects in Visual Studio yet). The main form can then read the DB and display the relevant data. The benefits I can see of this is that the tournament setup can be saved for future use, and player stats can be accumulated over time.
What sort of database object do I need to create to store this data, and how do I open connections etc and write data to the DB?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可能建议您使用 LINQ to SQL。 ScottGu 在博客文章中发表了一系列精彩的文章,介绍了如何用它来构建模型。对于一个简单的 CRUD 应用程序,您实际上只需要阅读前几部分。
参考:http://msdn.microsoft.com/en-us/library/bb425822.aspx
I'd probably suggest that you use LINQ to SQL. ScottGu did an excellent series on blog posts on how to build a model with this. You only really need to read the first few for a simple CRUD application.
Reference: http://msdn.microsoft.com/en-us/library/bb425822.aspx