我希望有人可以帮助我,因为这对我来说是非常重要的! [英] I hope somebody can help me, because it is very imoptant for me!

查看:78
本文介绍了我希望有人可以帮助我,因为这对我来说是非常重要的!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我正在开发一种以c#win形式进行智商测试的应用程序,我在测试中的要求有些与图像有关,有些与文本有关,我需要在进行测试时从数据库中随机抽取问题,然后开始创建sql中的表,但我不知道,因为一列可以是图像一个列可以是文本?


有人可以帮我吗?


Thnx

Hi!

I''am developing an application for IQ test in c# win form, my qoustion in the test some are with image and some are with text, and i need when i take the test the question to come random from database, I start to create a table in sql but i dont know becouse one column can be image one colomn can be a text?


Can somebody hepl me?


Thnx

推荐答案

为此,您需要创建三个表,第一个将是LookUp表,其中包含针对该记录存储的数据类型的信息. >
第二个表将是ValueLookUp,您将在其中存储记录的实际值以及LookUp表的外键引用.

第三个是ImageLookUp表,您将在其中存储图像以对照LookUp表的记录.

在LookUp表中,如果您记录的是值类型",则可以使用外键引用从ValueLookUp表中获取其值.如果它是图像类型,则可以使用LookUp表的外键从ImageLookUp表中获取图像.

希望这对您有帮助,请告诉我.
For this you need to create three tables the first one will be LookUp table with information of what type of data you are storing against that record.

And the second table will be a ValueLookUp where you will be storing the actual value of the record with a Foreign Key reference of the LookUp table.

And the third one will be a ImageLookUp table where you will store images against the record of the LookUp table.

In the LookUp table if you record is Value Type then you can its value from ValueLookUp table using the Foreign Key reference. And if it is an Image Type you can get the image from ImageLookUp table using the Foreign Key of LookUp table.

Hope this helps, tell me if I got you wrong.


在没有看到您的数据库结构的情况下,我不能说得很具体,但是我要做的是要么从他们的问题中分离出问题,要么数据(因此一个表将包含所有问题的列表,然后它们将链接到图像表或文本表),或者我将在一个表中同时包含两列(文本和图像).如果我做了第二个,那会更简单,但是会留下很多空列(可以).

在第二种情况下,您只需选择一个随机行,然后测试文本区域以查看其是否为空(或图片字段).如果为空,请选择要显示的另一个.如果不是,请显示该字段.

在第一个示例中,您需要根据指定类型(表示文本或图像的列)在第二个表(文本表或图像表)中进行第二次查找.
Without seeing your database structure, I cannot speak very specifically, but what I would do would be to either split out the questions from their data (so one table would contain a list of all of the questions and then they would link either to the image table or the text table) or I would include both columns in the one table (text and image). If I did the second, it would be simpler but it would leave a lot of null columns (which can be ok).

In the second scenario, you would simply pick a random row, then test the text area to see if it is null (or the picture field). If it is null, choose the other one to display. If it isn''t, display that field.

In the first example, you would need to do a second lookup based upon the specified type (a column saying text or image) into the second table (either the text table or the image table).


嗨.

因此,根据您的问题有一些不清楚的时刻.
为什么需要一列,其中可以包含不同的数据类型?)
创建具有两列(对于适当的数据类型文本/图像)可以包含NULL的表也许会更合理一些.将来当您尝试填充测试数据时,您将遍历记录并检查某些列是否为空,并依赖于返回类型为null或其他类型,否则您将为此创建适当的表示形式.

而且,我认为可以实现一列DB设计.
假设您将创建带有BLOB数据类型的列,并将其命名为 Data .然后,您只需填充数据即可进行二进制数据表示的测试.
对于数据检索,您将需要实现验证阶段,并以此结果填充您的UI.
Hi.

So, according to your question there is some unclear moment.
Why do you need one column, which can contains differ data types ?)
Maybe it would be more resonable to create table with 2 columns(for appropriate data types text/image) which can contains NULL. In future when you try to populate test data, you goes through records and check for null some of column, and depend from return type null or smth else you create appropriate representation for that.

But also, i think it''s possible to implement one column DB design.
Let assume, that you will create column whith BLOB data type and call it Data. Then you just populate data for test whith binary data representation.
For data retrieving, you will need to implemet validation stage and by that result populate your UI.


这篇关于我希望有人可以帮助我,因为这对我来说是非常重要的!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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