如何在c#代码中调用HTML镜像路径并使用c#asp.net保存到数据库中? [英] How to call HTML image path in c# code behind and save into the database using c# asp.net?

查看:57
本文介绍了如何在c#代码中调用HTML镜像路径并使用c#asp.net保存到数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



如何在c#代码中调用HTML图像路径并使用c#asp.net保存到数据库中?

我不想在我的Web应用程序中使用asp-image标签。

我有html图像标签,我想使用c#asp.net将图像保存到sql server数据库中。



请帮帮我。



怎么样,有可能吗?



先谢谢。



Ankit Agarwal

网站应用程序开发人员

Hello,

How to call HTML image path in c# code behind and save into the database using c# asp.net?
I don't want to take asp-image tag in my web application.
I have html image tag and i want to save image into the sql server database using c# asp.net.

Please help me.

How, it can be possible?

Thanks in Advance.

Ankit Agarwal
Website Application Developer

推荐答案

为了将图像保存到DB中,需要将其转换为字节格式。



然后将字节数组存储在DB中,同时检索值再次,您需要将byte []转换为图像。
For saving an image into DB, you need to convert it to byte format.

Then store the byte array in DB, and while retrieving the value again you need to convert the byte[] to image.


我建​​议您将图像的地址保存到数据库,以便它不会消耗太多资源:)
I suggest you save the address of the image to the database so that it wont consume much resources :)


这篇关于如何在c#代码中调用HTML镜像路径并使用c#asp.net保存到数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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