如何使用 .Net (C#/VB) 在 MySQL 中存储/检索 HTML [英] How to store/retrieve HTML in MySQL using .Net (C#/VB)

查看:33
本文介绍了如何使用 .Net (C#/VB) 在 MySQL 中存储/检索 HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:我需要将 HTML 存储在 MySQL 数据库中.之后,我需要能够检索 HTML 并使其成为浏览器可以呈现的有效 HTML.

Here is my problem: I need to store HTML in a MySQL database. Afterwards, I need to be able to retrieve the HTML and have it be valid HTML that a browser can render.

我的问题:如何使用 .Net 在 MySQL 数据库中存储 HTML?之后如何检索它? 由于这是设计阶段,我可以以任何需要的方式创建数据库.谢谢.

My question: How can I store HTML in a MySQL database using .Net? How do I retrieve it afterwards? As this is the design phase, I can create the database any way that is needed. Thank you.

附言我已经看到一些使用 PHP 和 JAva 的帖子,但我没有使用 PHP 或 Java,这些帖子并没有真正回答我的问题.

P.S. I have seen some posts on this using PHP and JAva but I am not using PHP or Java and those posts did not really answer my question.

推荐答案

您可以将 HTML 存储为 MySQL BLOB 格式的二进制流.您也可以在 .NET 中检索它.

You can store HTML as a binary stream in MySQL's BLOB format. Also you can retrieve it in .NET.

要检索和存储它,您只需在 .NET 中使用 Byte[].

To retrieve and store it, you can simply use Byte[] in .NET.

这是一个使用 BLOB 的示例:http://msdn.microsoft.com/en-us/library/87z0hy49.aspx

This is a sample using BLOB: http://msdn.microsoft.com/en-us/library/87z0hy49.aspx

这篇关于如何使用 .Net (C#/VB) 在 MySQL 中存储/检索 HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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