如何将数学表达式/解释存储到数据库中 [英] How to store mathematical expressions/explanations into database

查看:169
本文介绍了如何将数学表达式/解释存储到数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个在线考试练习网站,用户可以在该网站上进行考试和练习考试。练习考试时,用户可以查看正确答案及其说明。在数据库中存储数学问题很容易,但如何存储数学表达式,如分数,变量包含幂,微分,积分等。



我是什么尝试过:



这里是问题表: -



CREATE TABLE [ dbo]。[问题](

[QuestionId] INT IDENTITY(1,1)NOT NULL,

[SectionId] INT NOT NULL,

[PassageId] INT NULL,

[问题] VARCHAR(MAX)NOT NULL,

[Option1] VARCHAR(MAX)NOT NULL,

[Option2] VARCHAR(MAX)NOT NULL,

[Option3] VARCHAR(MAX)NOT NULL,

[Option4] VARCHAR(MAX)NOT NULL,

[CorrectAns] INT NOT NULL,

[描述] VARCHAR(MAX)NULL,

PRIMARY KEY CLUSTERED([QuestionId] ASC),
CONSTRAINT [FK_Questions_Section] FOREIGN KEY ([SectionId])REFERENCES [dbo]。[Section]([SectionId])

);

解决方案

将其保存为Rich Text - 并使用可显示RTF数据的显示控件 - 这样,您可以设置任何格式所需的文本,并在从数据库中取回时以相同的方式显示。

或者,您可以使用LaTeX:显示内联数学,就好像它一样显示数学 - TeX - LaTeX Stack Exchange [ ^ ]

您必须查找可显示所选数据格式的网页控件,但Google会帮助您。

I am making an online exam practice website in which user can give test and practice exams . While practicing exam user can view correct answer and it's explanation. It is easy to store mathematics questions in database but how to store mathematical expressions like fraction numbers, variable containing powers, differentiation, Integration, etc.

What I have tried:

here is the table of questions :-

CREATE TABLE [dbo].[Questions] (
[QuestionId] INT IDENTITY (1, 1) NOT NULL,
[SectionId] INT NOT NULL,
[PassageId] INT NULL,
[Question] VARCHAR (MAX) NOT NULL,
[Option1] VARCHAR (MAX) NOT NULL,
[Option2] VARCHAR (MAX) NOT NULL,
[Option3] VARCHAR (MAX) NOT NULL,
[Option4] VARCHAR (MAX) NOT NULL,
[CorrectAns] INT NOT NULL,
[Description] VARCHAR (MAX) NULL,
PRIMARY KEY CLUSTERED ([QuestionId] ASC),
CONSTRAINT [FK_Questions_Section] FOREIGN KEY ([SectionId]) REFERENCES [dbo].[Section] ([SectionId])
);

解决方案

Save it as Rich Text - and use a display control that can display RTF data - that way, you can set up the text you need to any format and display it the same way when you pull it back from the DB.
Alternatively, you could use LaTeX: Show inline math as if it were display math - TeX - LaTeX Stack Exchange[^]
You will have to look for web controls which can display your chosen data format, but Google will help you there.


这篇关于如何将数学表达式/解释存储到数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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