DataSource Controls :: Retrieving Images From Database?
May 1, 2010iam using asp.net with c#
iam saving two images in database but while retreving only one image is displaying
can you correct my code
[Code]....
iam using asp.net with c#
iam saving two images in database but while retreving only one image is displaying
can you correct my code
[Code]....
[Code]....
i am using asp.net with c#, i have table images
shop nvarchar(50),
imgc image
imgo image
iam saving images in a database but while retreving it is showing blank images. i want to display as thumb nail images
I am facing a problem with retrieving an image and showing it on asp.net grid. I migrated MS Access database to sql server. Image are visible in Crystal report when fetched from the same database (migrated sql server database). But same images are not visible in ASP.Net grid view or simple asp.net image control. Following is my code
SqlConnection oConn =
new
SqlConnection(ConfigurationManager.ConnectionStrings["csr"].ToString());
oConn.Open();
SqlCommand oraCmd = oConn.CreateCommand();
oraCmd.CommandText = "select top 1 photo from [test] where photo is not null";
SqlDataReader dr =
null;
dr = oraCmd .ExecuteReader ();
if(dr.Read ())
if (dr["photo"] !=
null)
{
Response.ContentType = "image/gif";
Response.BinaryWrite((byte[])dr["photo"]);
}
This function is getting called from another page . "hlopen" is hyper link in the grid. hlopen.NavigateUrl = "GetPhoto.aspx?id=1";
i am looking for some sample code in order to upload and/or retrieve images stored in a database.even the web is full of samples, i was not able to find one without using blobs as i would like to save only the directory of an image when it comes to the place of storing. the reason behind is that i do want to have my database small for some reason and therefore only want to save links to my images inside.
View 5 Repliesi am looking for a very simple way to display images on my form by retrieving them form sql database, by chosing their IDs.
View 8 Repliesi am a beginer and i want to know how to store images in the database tables like pictures of the pizzas and when the user selects one of the pizza from the dropdownlist he sees the image of the selected pizza.
View 2 RepliesI am trying to retrieve a Guid from the database but my application just isnt having it. I have a field in the database called "LoginUserId" and it is of type "uniqueidentifier".In my User Model I have:
[Code]....
I keep getting the error: Specified cast is not valid.
I'am Developing a commercial website using vs2005 and sql 2005,where my users will download and upload wallpapers and ringtones,so my issue is,i got the coding for uploading ,ut the problem is it is storing the files two times, the code i have used is in the following link,http://www.beansoftware.com/asp.net-tutorials/images-database.aspx
View 10 RepliesI have a picture that i would like to upload to a database. I am really new to this so i am not sure what to do. I have been using the following code below to upload and retrieve the picture, looks like its uploading ok, but i cant retrieve it. The code i am using comes from this site,
http://www.dotnetcurry.com/%28X%281%29S%28e2mwozemizhla24555f41uzz%29%29/ShowArticle.aspx?ID=129&AspxAutoDetectCookieSupport=1.
Uploading Content to database
try
{
if (cmboTopic.Text == "Blu-Ray Movie")[code].....
On UI Ajax calendar control is used to allow the user Expiry Date as shown below. As this is one of the controls in search, when the Search button is pressed using SQL statement (copied below) data is retrieved from ExpiryDate column of the table. The table creator declared the column type as string and the dates are saved as single digits(Example: 2/2/10 sometimes and sometime as double digits (Example: 02/02/10) I like to know the best practice in retrieving both type of strings from database table. Calendar control
[Code]....
SQL(part of stored proc)
[Code]....
with in button click event stored procedure is called to return search results.
Would like enquire how to retrieve images from database.I have a table call "Image" with 3 attributes.. ImageID, AlbumID and ImagePath.I want to retrieve the photo and display out at my index page inside a gridview which will display the photos that recent users uploaded.My friend suggested the Eval way, but i have no idea how to do it.
View 3 Repliespost the C# source code for uploading images to a database, and then showing it to the user?? I have tried now for 3 weeks with no luck... Maybe we should recommend to Microsoft to add a file upload html helper method to MVC 3?
View 4 RepliesIs linq just for retrieving data or can you send data to the database using it?
View 3 RepliesI have some issues about retrieveing and storing date information to my database (ms sql server 2005).My data column is a DateTime, and i have set my web.config globalization culture is set to "en-gb"
When i retrieve date from the datebase it appears as dd/MM/yy, that's fine. But i cannot insert a new date as same format?! It will only accept MM/dd/yy or yy/mm/dd.Right now i'm using this code to correct the error:
[Code]....
Is it possible to change the date format on the database or something, so i dont need to use this code?
Here is what I am basically trying to accomplish I want to upload images to the server separated into categories and save the file path into the database. I have found plenty of documentation on saving to a file and the file path to a database. But, I haven't found anything that will allow me to seperate the images into categoies.
I have made three tables in the database
[code]....
What I am trying to do is create a gallery for our clients to browse and download different vesions of posters and ad cards.
I have an application that uses an Asynchronous HttpHandler for retrieving images from a fileshare It appears the performance of this is quite poor. I have two questions:1. Does it make sense to use an IHttpAsyncHandler for this or will an IHttpHandler work fine? I have four images on a page that need to be loaded this way and it seems that they all load sequentially instead of in parallel. Since we have some JavaScript in the body onload event, it doesn't get excuted until all four images are finished loadingy bearing on this.
View 1 RepliesI am designing an prototyping an app the needs to store images, similar to facebook. This will be a public facing site and I am not sure how many users I will end up with but what I am looking for is a way to efficiently retrieve them.
So far I am thinking of storing them in SQL Server varbinary columns. I have the upload code and the storage code for that. My concern is retrieving them. I can retireve and build the image tag on the fly but I am worried about having to hit the database for each one.
I have been thinking about getting all images for a user and caching them in the asp.net cache for 10 to 30 seconds. I have never had to do something like this so I would be interested in hearing a few different approaches. Obviously the images can vary in size and I was thinking about defining a size limit, but I haven't gotten that far yet.
I store images in mysql as a longblob. The image control only takes an imageurl, so I have to have an ashx page serve up the images and then the image control uses that page as the imageurl. It works, but does that mean I have to do this for each image, kinda gets complicated for a lot of images.
Or should I just store the images on the hard disk? I am worried though about the space I would need if my site grows, as I want it scalable.
I want to create a page that will dynamically change the images displayed, based on which link the user clicked to get there. For example I have different movies listed and when you click a link for one of them it displays all the images for that movie. I need it to be on one page because at the moment I have hundreds of pages and its very hard to manage. I have the images stored in BLOBS on SQL Server 2005. I can retrieve all the images for a certain category and store the Image data for each one into a list of images. What I cant do, is display the images on the page. I can display one image by using the queryString to get the image by ID, then putting the Eval code into an asp:image, but I dont know how to do it for multiple images.
View 7 RepliesWhen I used the (way #1) below I could retrieve search result from my DB
Way #1:
[Code]....
But When I use( way#2) "separating my code to Presentation layer and data access layer ( using SQL HELPER CLASS )"
Way # 2
Presentation layer: protected void btn_Search_Advance_Click(object sender, EventArgs e)
[Code]....
data access layer:
[Code]....
I keep getting this error: Procedure or function 'SP_Search' expects parameter '@SEARCHTYPE', which was not supplied.
I'm quite new to ASP.NET and i was wondering if someone could answer some of my questions.1. What is the difference between a DataTable and an Array? Is the DataTable a serverside control? Is it exposed to the user?2. Does the reader retrieve the column names? If so- how can I capture them? Are they the first row?2. Is it possible to populate an Array using the following sort of code, and if so- how?:
SqlCommand tableCommand = new SqlCommand();
SqlConnection tableConnection = new SqlConnection();
tableCommand.Connection = tableConnection;
[code]...
I try to use one Calendar, i have example with XML, but i wont to read from SQL,
[Code]....
I'm new to asp.net, php had this function that could store sql date in an array, I can't find something similar in .net, so this is what I came up with so far.
Sub Compareid()
Dim queryString As String = "Select top 2 id from my_videos order by id desc"
using connection As New SqlConnection(ConfigurationSettings.AppSettings("sqlacct")
[code]...
Is it better to store images directly in a database or to just store the name of the file in the db and display that file? I would think that just storing the filename of the image would keep the db size low...
View 1 RepliesI have hard time trying to find the solution to retrieve data from multiple tables in one database.
table Kategorije has fields: idKategorija, naziv, opis table Clanak has fields: idClanak, idKategorija, naslov, autor,...
Kategorije.idKategorijais joined with Clanak.idKategorija, but that isn't the solution because I want my web site to show the Kategorije.naziv instead of Kategorije.idKategorija. This is the code I'm currently using to get idKategorije shown on my web site:
[Code]....
[Code]....