如何将物理公式存储到数据库? [英] How Can I Store Physics Formulas To Database ?

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

问题描述

任何人都可以帮助将这些类型的符号存储到数据库中

can any one help regarding storing these type of symbols to database

v = v<sub>0/sub>+ at<sup>2</sup>

推荐答案

太懒了!所有这些都是简单的XML格式(HTML可能?),它们可以以字符串的形式存储(有效)。 HTML可以简单地存储在字符串变量中,



Too lazy! All of these are simple XML format (HTML probably?) and they can be stored (efficiently) in form of string. HTML can be simply stored inside string variables,

string data = "v = v<sub>0</sub> + at<sup>2</sup>";





只需运行一个简单的 INSERT INTO 命令就可以了。例如,





Just run a simple INSERT INTO command and you're done. For example this,

var command = new SqlCommand("INSERT INTO table (column1) VALUES (@0)", connection);
command.Parameters.Add(new SqlParameter("0", data));
command.ExecuteNonQuery(); // don't want to store "RowsAffected"!





提取它们(如果需要),解析为HTML,你就可以了。 Html.Raw(data)是ASP.NET中此任务的常见示例。 data 将被评估为具有的字符串内容,然后元素将被解析为HTML内容;然后呈现。



编辑



你还应该注意这些物理表达(那个你已经弥补了不是数据库中的物理表达。这只是数据!除非它们是某种表达式构建器...所以任何类型的数据,转换为字符串,存储它(假设该列也有类型或nvarchar而不是其他类型,如bigint,bit,date等)。这些符号一旦在浏览器中呈现,子类型和sup-type就是浏览器中的元素类型,将元素呈现在其他上方或下方。所以它们根本不是这个符号的符号( string )。 他们只是人物



您可能也会觉得这很有帮助:如何将SQL数据库连接到您的C#程序,初学者的教程 [ ^ ]



Extract them (when required), parse to HTML and you're good to go. Html.Raw(data) is a common example of this task in ASP.NET. The "data" would be evaluated to the string content that is has and then the elements would be parsed as HTML content; then rendered.

Edit

You should also note that these physical expressions (that you've made up) are not physical expressions in database. It is just data! Unless they are some sort of expression builders... So any kind of data, convert to string, store it (provided that the column also has type or nvarchar and not other types such as bigint, bit, date etc.). These are symbols once they are rendered in the browser the sub-type and sup-type are element types in browser, rendering the element above or below other. So they are not at all a symbol in this notation (string). They are just characters.

You might also find this helpful: How to connect SQL Database to your C# program, beginner's tutorial[^]


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

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