用户使用文件上传控件上传多个附件时,如何在sql数据库列中保存多个文件路径? [英] how to save multiple file paths in sql database column when user uploads multiple attachments using file upload control?

查看:370
本文介绍了用户使用文件上传控件上传多个附件时,如何在sql数据库列中保存多个文件路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net FileUpload控件.

现在,我想上传多个附件并将上传的文件路径保存在sql数据库中.

如果用户使用文件上传控件上传多个附件,如何在sql服务器列中保存多个文件路径?

我想要代码如何在sql server文件路径列中保存多个文件路径吗?

I have an asp.net FileUpload control.

Now i want to upload multiple attachments and save uploaded file paths in sql database.

here how to save multiple file paths in sql server column if user uploads multiple attachments using file upload control?

i want the code how to save multiple file paths in sql server file path column?

推荐答案

嗯,您有两个选择.一种:选择一个对文件路径无效的字符(例如?),并将其用作分隔符,以存储需要拆分的列表.其次,创建一个映射表,以便您可以通过其ID将多个文件路径映射到一个条目.因此,您的主表具有一个id列,新表包含该id和一个文件路径,每个路径具有一个条目.
Well, you have two options. One : choose a character that is not valid for a file path, like ?, and use that as a delimiter to store a list that needs to be split. Second, create a mapping table so you can map multiple file paths to one entry by it''s id. So your main table has an id column and your new table contains that id, and a file path, with one entry per path.


这篇关于用户使用文件上传控件上传多个附件时,如何在sql数据库列中保存多个文件路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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