生成表单数据的数字 [英] generate numbers for form data

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

问题描述

嗨:)我有一些存储在数据库中的表单数据,每个表单都有一个ref num ..这就是问题



假设我有四个参考号码的表格说001,002,003,004我希望001和003组合在一起并生成一个数字说1,然后我想将002和004组合在一起并生成一个数字说2.



所以在数据库中它看起来像

Hi :) I have some form data that is stored in the database and each form has a ref num..So here is the problem

Suppose i have four ref numbers of the forms say 001,002,003,004 I want 001 and 003 grouped together and generate a number say 1,then i want 002 and 004 grouped together and generate a number say 2.

So in the DB it will look like

Name Desig Ref ID
xyz   abc  001  1
abc   asd  003  1
def   sed  002  2
fgh   hjk  004  2



有人可以告诉我如何实现这个c#和SQL ..我只想知道如何执行此操作的基本逻辑而不是代码...我应该使用datagrid吗?如果是这样的话,我该如何处理对ref数字进行分组?


Can someone let me know how to implement this on c# and SQL..I just want the basic logic on how to do this and not the code...should i use datagrid?if so then how do i work on grouping the ref numbers?

推荐答案

在数据库方面,您需要一个新的表组。该表具有自动生成的ID(自动增量)作为组的ID(在您的示例中未显示,仅在内部使用)。您可以添加额外的列,例如组的描述。

另一个新表存储现有数据与组的关系:它包含组的ID和数据的ID(ref)。

在C#应用程序中,您可以使用字典< Group,YourData> ;处理它。
On the database side, you need a new table for the groups. That table has an automatically generated ID (autoincrement) as the group's ID (which is not shown in your example, only used internally). You may add extra columns for e.g. a description of the group.
Another new table stores the relation of your existing data with the group: it contains the ID of the group and the ID ("ref") of your data.
In the C# application, you could use a Dictionary<Group, YourData>; for handling that.


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

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