将pdf文件保存在数据库中

编程入门 行业动态 更新时间:2024-10-27 12:28:13
本文介绍了将pdf文件保存在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在不使用文件上传控制的情况下直接将pdf文件插入数据库. pdf文件已保存在C:drive中! 请给我帮助!!

How can be insert pdf file in database directly without use file upload control . pdf file already save in C:drive ! Please Give mi help !!

推荐答案

取决于C:驱动器的位置. 如果它在您的服务器上,则很容易:只需将文件作为字节流读取(使用File.ReadAllBytes),然后使用参数化查询将其写入数据库. 如果它在客户端上,则不能-您必须先使用上载控件将其传输到服务器. Depends on where the C: drive is. If it is on your Server, then it is easy: just read the file as a stream of bytes (use File.ReadAllBytes) and write it to the database using a parametrised query. If it is on the client, then you can''t - you have to use an upload control to transfer it to the server first.

更多推荐

将pdf文件保存在数据库中

本文发布于:2023-11-07 01:17:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565157.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库中   文件   pdf

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!