如何在asp.net上传图片然后将其插入数据库? [英] how to upload picture in asp.net and then insert it into the database?

查看:131
本文介绍了如何在asp.net上传图片然后将其插入数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。



我想在Asp.net上传一张图片并将其插入数据库(sql server)。但我有两个问题:



1-如何在数据库中创建一个表来处理上传图片所需的任何数据?以及如何使用datataype?

就是这个正确的例子:



ImageId ------ int

ImageType ----- Nvarchar

ImageSize ------ int

Image -------- image



2-如何在asp.net上传图片然后插入数据库。尽管如此我在谷歌搜索但是我没有找到任何具体的案例来解决这个问题。



i将会感谢您的建议。

Hi.

I want to upload a picture in Asp.net and insert it into the database (sql server ). but i have two problem :

1- how can i create a table in database to be involved any needed data for upload picture? and how it''s datataype has to be?
is this correct example :

ImageId ------ int
ImageType ----- Nvarchar
ImageSize------ int
Image-------- image

2- how can upload the picture in asp.net and then insert into the database. in spite of that i searched in Google but i didn''t find any specific case for this issue iam looking for.

i will be thankfull for your advise.

推荐答案

1。 这取决于您要存储的信息。

但是最小列将如下所示...

- > ImageID 身份),

- > ImageName Varchar(50))和

- > 图片图片



2. 请参阅以下文章。

- > FileUpload在ASP.NET中的数据库中保存图像 [ ^ ]。

- > 将图像上传到Sql Server C#和ASP.Net中的数据库 [ ^ ]。

- > 将图像插入数据库并通过Handler.ashx在GridView中显示 [ ^ ]。



谢谢......
1. It depends what are the information you want to store.
But the minimum columns would be like below...
-> ImageID (Identity),
-> ImageName (Varchar(50)) and
-> Image (image)

2. Refer the following articles.
-> FileUpload Save Images In Database In ASP.NET[^].
-> Upload image to Sql Server Database in C# and ASP.Net[^].
-> Inserting Images into Database and Display it in GridView through Handler.ashx[^].

Thanks...


这篇关于如何在asp.net上传图片然后将其插入数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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