存储可变数据 [英] Storing variable data

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

问题描述

我建立在ASP.NET,C#,MVC3应用程序和SQL Server 2008。

I am building an application in ASP.NET, C#, MVC3 and SQL Server 2008.

一个形式是psented将用户填写(姓名,电子邮件地址等)$ P $。
我想允许应用程序的管理员多余的,动态的问题,到这个形式。

A form is presented to a user to fill out (name, email, address, etc). I would like to allow the admin of the application to add extra, dynamic questions to this form.

的额外问题的量,并返回将改变的数据的类型。
例如,管理员可以添加0,1或多个以下类型的问题:

The amount of extra questions and the type of data returned will vary. For instance, the admin could add 0, 1 or more of the following types of questions:


  1. 你有一个完整的,干净的驾驶liscence?

  2. 评级您drivings技能从1到5。

  3. 描述你在长途旅行去了是什么时候?

  4. 等...

请注意,所提供的答案可能是二进制文件(问题1),整数(问题2)或自由文本(问题3)。

Note, that the answers provided could be binary (Q.1), integer (Q.2) or free text (Q.3).

什么是存储在MS SQL这样的随机数据的最佳方式?

What is the best way of storing random data like this in MS SQL?

任何帮助将大大appriecated。

Any help would be greatly appriecated.

先谢谢了。

推荐答案

我想创建一个表具有以下的列,并在相应的列与所有其他值与值一起存储变量的名称为null。

I would create a table with the following columns and store the name of the variable along with value in the appropriate column with all other values null.

id:int (primary)
name:varchar(100)
value_bool:bit(nullable)
value_int:int (nullable)
value_text:varchar(100) (nullable)

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

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