为照相馆创建数据库表 [英] create database table for photo gallery

查看:87
本文介绍了为照相馆创建数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿!
我正在开发一个照相馆网站.用户使用用户名,密码和电子邮件(PK)创建帐户,该帐户存储在数据库表user_info中.然后用户使用电子邮件和密码登录.
在下一步,他上传了多张照片.现在在这里,我很困惑如何创建一个数据库表,其中多个图片与用户email(Fk)一起存储.
请有人告诉我如何为相册创建表格.

hey there!
i am developing a photo gallery website. user creates account using username, password and email(PK), which is stored in db table user_info. then user log in using email and password.
at next step he uploads multiple photos. now here i am confused how to create a db table where multiple pictures are stored with user email(Fk).
please somebody tell me how to create table for photo gallery.
thanks in advance.

推荐答案

每张照片都有一个用户ID(而不是用户电子邮件)作为一列,以告诉您它是谁的照片.将其加入用户表以查找其电子邮件
Each photo has the user id, not the user email, as a column, to tell you whose photo it is. You join this to the user table to find their email


虽然您可以使用varbinary字段将照片存储在数据库中,但我建议考虑使用FILESTREAM作为将照片存储在外部的选项数据库文件,而仍由SQL Server处理.

例如,请查看本文如何将二进制数据存储和提取到文件流列中 [
While you can use a varbinary field for storing the photo inside the database, I would suggest considering FILESTREAM as an option to store the photo outside the database files, while still handled by SQL Server.

For example, have a look at this article How to store and fetch binary data into a file stream column[^]


^ ]
http://www.aspnettutorials.com/tutorials/database/saving-retrieving-image- cs.aspx [ ^ ]
http://code.msdn.microsoft.com/Read-and-Write- to-a-SQL-9082c500 [ ^ ]
http://www.shabdar.org/sql-server/105-store-save-images-in-sql-server.html[^]
http://www.aspnettutorials.com/tutorials/database/saving-retrieving-image-cs.aspx[^]
http://code.msdn.microsoft.com/Read-and-Write-to-a-SQL-9082c500[^]


这篇关于为照相馆创建数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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