如何将任何文件保存在数据库中并检索它在imagebutton控件中显示 [英] how to save any file in database and retriving it showing it in imagebutton control
问题描述
我有我的imagebutton控件,上面带有默认图像.我想要的是,当我单击该imagebutton时,我的文件应该从我们的计算机中上传到数据库中,并且应该保存在数据库中,并且也应该被看到在那个imagebutton.for中,我已将代码编写为
插入上载文件值(@ userid,@ file).这是代码,不会给我任何错误,但我不知道我的文件是否确实保存在数据库中,
我已将表数据类型用作userid的"varchar"和用于文件的"image"
但我无法检索该图像并在imagebutton中显示.
我将代码编写为
从表名中选择图像,其中userid = @ id"
while(dr.read())
{
imgbtn = dr ["images"];
}
我也使用了fileupload控件.
通常我的想法是制作一个像项目一样的facebook.用户也可以上传尽可能多的文件,请帮助我提供一个我可以轻松理解的代码.
i have i imagebutton control with a default image on it.what i want that when i click on that imagebutton i file should be uploaded in database from our computer and should be saved on the database,and also should be seen in that imagebutton.for that i have written code as
"insert into uploadfile values (@userid,@file).this is code not giving me any error but i dont know that really my file is being saved in the database, also
i have used table datatype as ''varchar'' for userid and ''image'' for file
but i am not able to retrive that image and show in the imagebutton.
i am writing the code as
"select images from tablename where userid=@id"
while(dr.read())
{
imgbtn=dr["images"];
}
i have also used fileupload control.
atually my idea is to make a facebook like project.also user can upload as many as file please help give me a code which i can understand easily .
推荐答案
快速搜索给出了这两篇文章.看看是否有帮助:
第1条 [第2条 [
A quick search gave these two articles. See if it helps:
Article 1[^]
Article 2[^]
这篇关于如何将任何文件保存在数据库中并检索它在imagebutton控件中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!