Visual Studio :: Load Images From Database To Display In Image Content In Web Pages?

Dec 27, 2010

i have encountered a problem on how to load the database images to be display in the Image content in the web pages. I am currently using an Access database with a table "Images" and there are 4 columns in it. "ImageID", "ImageDescription","ImageofPicture","Description". Below is my code: Words highlighted in bold is where the problem occurs. No image is display in the Image box but theres a red cross at the top left. Image description is displaying fine in the textboxes

int MaxRows = 0;
int inc = 0;
int inc1 = 1;
int inc2 = 2;
int inc3 = 3;
System.Data.OleDb.OleDbConnection cs;
System.Data.OleDb.OleDbDataAdapter dta;
DataSet ds1;
byte[] photo_array;
protected void Page_Load(object sender, EventArgs e)
cs = new System.Data.OleDb.OleDbConnection();
//tell the program where the database is located
cs.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Users\Admin\Desktop\Website1\App_Data\Database.mdb";
ds1 = new DataSet();
string sql = "SELECT * From Images ORDER BY ImageDescription ASC";
dta = new System.Data.OleDb.OleDbDataAdapter(sql, cs);
dta.Fill(ds1, "Images");
//MaxRows equals to the total amount of records from the database
MaxRows = ds1.Tables["Images"].Rows.Count;
private void Navigation()
//get the first records from the database
DataRow dtaRow = ds1.Tables["Images"].Rows[inc];
//get column values in the row
TextBox3.Text = dtaRow.ItemArray.GetValue(1).ToString();
TextBox7.Text = dtaRow.ItemArray.GetValue(3).ToString();
DataRow dtaRow1 = ds1.Tables["Images"].Rows[inc1];
TextBox4.Text = dtaRow1.ItemArray.GetValue(1).ToString();
TextBox2.Text = dtaRow1.ItemArray.GetValue(3).ToString();
DataRow dtaRow2 = ds1.Tables["Images"].Rows[inc2];
TextBox5.Text = dtaRow2.ItemArray.GetValue(1).ToString();
TextBox8.Text = dtaRow2.ItemArray.GetValue(3).ToString();
DataRow dtaRow3 = ds1.Tables["Images"].Rows[inc3];
TextBox6.Text = dtaRow3.ItemArray.GetValue(1).ToString();
TextBox9.Text = dtaRow3.ItemArray.GetValue(3).ToString();
//if 3rd column value is not null
if (ds1.Tables[0].Rows[inc][2] != System.DBNull.Value)
Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox3.Text;
if (ds1.Tables[0].Rows[inc1][2] != System.DBNull.Value)
Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox4.Text;
if (ds1.Tables[0].Rows[inc2][2] != System.DBNull.Value)
Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox5.Text;
if (ds1.Tables[0].Rows[inc3][2] != System.DBNull.Value)
Image5.ImageUrl = "ImageHandler.ashx?ImageDescription=" + TextBox6.Text;
Code for ImageHandler.ashx:
using System;
using System.Web;
using System.Data.OleDb;
public class ImageHandler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string qry = "SELECT ImageofPicture FROM Images WHERE ImageDescription = ?";
string connect = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\Users\Admin\Desktop\Website1\App_Data\Database.mdb";
using (OleDbConnection conn = new OleDbConnection(connect))
if (context.Request.QueryString["id"] != null)
OleDbCommand cmd = new OleDbCommand(qry, conn);
cmd.Parameters.AddWithValue("", context.Request.QueryString["id"]);
using (OleDbDataReader rdr = cmd.ExecuteReader())
if (rdr.HasRows)
context.Response.ContentType = "image/jpeg";
public bool IsReusable {
get {
return false;

View 5 Replies

Similar Messages:

Visual Studio :: (VWE 2010) Searching Images In Pages?

Nov 15, 2010

I am not sure this is the right place to ask.I am using Visual Web Developer 2010 Express, and have loaded an existing project.I have an image folder, and in the folder I have some images (.png)I need to find all of the ASP.NET pages which uses one of this image,but had no luck. There are hundreds of ASPX, ASPX.vb pages to search...IS THERE A WAY TO SEARCH WHICH ASPX or ASPX.VB pages are using a image file?For example,If I have C:TESTIMAGESTEST.PNG file,I want every file in the project pages which includes:


View 4 Replies

Visual Studio :: How To Work Only On Content Place Holder In VS2010 Without Seeing Master Pages

Jan 25, 2011

I am wondering if it's possible to work on Content Place Holder window without seeing master page template?

The second problem i've noticed is that when i try to add a table (1 row, 3 columns) to my content place holder and then try to adjust the width of those columns the whole layout of my page is getting messed up to the point that i have to use ctrl+x to go back to previous stage. The master page was very complicated but i finally got it to work and i don't understand why while i manipulate contentplaceholder the layout of the master page is being affected. (only when adjusting tables)I am new to Visual Studio and was wondering of any known standars in that matter.

View 4 Replies

Web Forms :: Creating Content Pages - Read Data From Database And Display On Template

Jan 4, 2011

I am working on a medium size web site and I am kind of stuck. I need to do the following

1- admin user fill a form and submit (Done)
2- the system create new page storing the info provided in step 1

how can I do that? I need a page to be created I don't want to read the data from data base and display it on a template

View 1 Replies

Visual Studio :: After 2010 Conversion From 2008 Pages Won't Display In Browser Correctly

Sep 29, 2010

I just upgraded to 2010 and converted my VS 2008 ASP.NET web application. There were no conversion errors and everything displays in the Design mode correctly but when I try to View in Browser or debug the site won't display. I just get a blank page untitled page displayed.

View 1 Replies

MVC :: Images In Content Directory / Internal Visual Studio Web Server Work Well But Not On Other IIS Server?

Nov 11, 2010

sorry for buther I'm a newbie in ASP.NEt MVC and I have some issue deploying my application on IIS, that use a logo image within my main master page declared as

<img src="../../Content/logo.bmp" alt="logo" />

When I use the internal visual studio web server work well but not on my other IIS Server.

What's the mean of ../../Content ? Is this directory deployed with particular rules?

View 2 Replies

Web Forms :: Add And Retrieve Image From SQL Database In Visual Studio 2008?

Apr 29, 2010

How to add and retrieve an image from SQL database in Visual Studio 2008? Do I need to use the upload file control?

View 9 Replies

SQL Server :: Database Display In Visual Studio 2008 Express?

Aug 31, 2010

I jsut installed SQL server and management studio on my PC. For management studio, I created a database with tables. However, When I have data connection for SQL server in visual studio express, I couldn' t see the database I created.

View 1 Replies

Visual Studio :: Tried To Install Prof 2010 Trail Version In System / 'Please Remove/uninstall Visual Studio 2010 Load Test Controller'?

Jul 6, 2010

I tried to install Visual Studio Prof 2010 trail version in my system, but i got an error saying 'Please remove/uninstall Visual Studio 2010 load test controller' to proceed installation. i uninstalled my previous VS2008 software from system and i could not find anything like 'Remove/Uninstall Visual Studio 2010 load test controller' software in my Add/Remove Programs.

View 1 Replies

Web Forms :: Retrieving Images From Database And Display As Thumbnail Images

Apr 29, 2010


i am using 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

View 1 Replies

Visual Studio :: Sync Pages With The Live Site From Somewhere In Visual Web Developer?

Oct 22, 2010

More familar with DreamWeaver. Can i sync pages with the live site from somewhere in Visual Web Developer? Or do I need to use a separate FTP tool.

View 3 Replies

Web Forms :: Want The AdRotator Control Functionality Where Content Pages On Page Load?

Nov 5, 2010

I want the AdRotator control functionality where content pages on page load but instead of using images I want to use html and other controls like textboxes and buttons. Is this possible?

View 1 Replies

Visual Studio :: Can't Open A SourceSafe 6 Database With Visual Studio 2005?

May 25, 2010

I know both these software are old and that I can update to newer version. But I need to do it with those software in particular.I have Visual Studio 2005 and Visual SourceSafe 6 installed on my computer. When I try to open Visual SourceSafe 6 database using Visual SourceSafe 6 directly, I have no problem at all.Then I try to open a project solution I took from SourceSafe using Visual Studio 2005. Right away I receive this messageThe solution appears to be under source control, but its binding information cannot be found. It is possible that the MSSCCPRJ.SCC file or another item that holds the source control settings for the solution, has been deleted. Because it is not possible to recover this missing information automatically, the projects whose bindings are missing will be treated as not under source control.

Then an invite to chose a SourceSafe Database open. I click on BROWSE. First thing I noticed : The SourceSafe available databases list is empty (while I remind, it's not in SourceSafe 6. I can see there the COMMON database and the VSS database which is located on a different server on our network. Before that, I went in TOOLS->OPTIONS->SOURCE CONTROL, and make sure Visual Source Safe was selected as the Plug-in to use for a Source Control).So I click again on Browse, and locate my srcsafe.ini file. Everything is OK. It evens confirm me that my database path is
\dev2k3programmationVSS and that my database name is indeed VSS. So it found it. I then click on OK.

But when I do, the Database is not added to my available list, at all. The result, I can never select a source control, ever, which end in me not being able to work connected to the main source control of our network. Everything is working fine on every other computer in our company. Only this one have problem.Did I give enough description to my problem? I really need help on this one, because working disconnected from Source Safe can give a lot of pain to our team. Can anyone give me an hand? If you need any more info, just ask.

View 2 Replies

Web Forms :: How To Make One Image Load First On A Webpage Before The Other 20 Images

Jul 15, 2010

In my webpage I have 20 .jpg Images. Sometimes it can take about 10 seconds before the webpage is loaded and all images are seen.

I have one .jpg image that are more important to visually see first before the others.

So my question is if it is possible to "force" one image to load the Very first to be seen visually? I dont know if this works in a specific order or the webpage renders it by random?

View 21 Replies

Best Way To Store Images To Database Table For Web Pages?

Dec 7, 2010 them in the file system of web server and put the url in the table? them as type "image"? them as varbinary(max) BLOB? them as filestream data?

View 2 Replies

Load Different Size And Weight Images From One Column Image Data Type?

Aug 8, 2010

I'm going to design a database for an image gallery in ASP.NET Web App . Because of some reasons I've decided to store the image in Data Base , Not the address .

In the application i need two or more different size and weight image for each image that the admin insert .For instance , One of them is small and lightweight thumbnail , and the other is Original big one .

My question is : Should i have two column ( one for lightweight and small thumbnail and one for big and full size one ) in DataBase Or Is there any way i could load different size and wight image from Big and original image column ?

View 1 Replies

Web Forms :: Batch Creation Of Content Pages (re: Master / Content Pages)

Apr 19, 2010

I have over 300 content pages to create. Each has some standard styling. I would like to generate these pages, and was just wondering if there is a utility in web developer 2008 express to do so (otherwise I will just build one - but it would be great not having to do so!)

View 1 Replies

Forms Data Controls :: Create Image Gallery (load Images From Sql Server)?

Aug 17, 2010

how to create image gallery? (load images from sql server)

i'm created that use asp:table control

View 4 Replies

Visual Studio :: Importing Files And Images Into VWD 10 Express?

Nov 21, 2010

I am working on my first ASP.NET Website using VWD and C#. I did some inital design with Expression Web 4 such as created a master page with 2 content place holders, 2 style sheets 1 for the layout and 1 for the nav menu, and some images in a folder. I started with an empty site opened my masterpage and saved it to the VWD directory. Now my Solution Explorer contains a MasterPage and a webconfig .cs file. I would like to import the style sheets and images I mentioned earlier but I am not sure how to accomplish this. do I have to open and save as all these items or can I impot them? Do I use the ADD NEW Item command?

View 3 Replies

Visual Studio :: How To Access Pages Remotely In XP

Dec 24, 2010

I am facing a problem in accessing the webpages remotely.

i am using the server as my windows 7 laptop with vs2008 and sql server 2008. when i try to connect from client XP PC it says time out error.

View 6 Replies

Visual Studio :: VWD 2010 Not Rebuilding Pages Or Is It Me?

Oct 13, 2010

I chose the option to create a new ASP.NET Web Application (C#) project using VWD 2010 EXPRESS. Normally I choose the create an empty web site option. Anyways, It seems that everytime I needed to make a change in code behind that I would have to click save, then debug>build for the changes to take effect. This was working fine for three days, now all of a sudden it has stopped working. It doesnt seem to rebuild when I click build...though the output message says it succeeded.

I have even removed entire codeblocks from the codbehind (one that populated a dropdown), yet the drop down is still populated when the page is previewed (I have cleared the browser cache as well!). Also, I have tried to set Label1.text to various values and that does show either, like its not in the code.Is there a bug in VWD, or is there a setting I could have clicked unknowingly? I am gettingsome strange errors as well. For example, I am getting object reference not set to an instance of an object errors and the line it points to is a totally empty line

View 1 Replies

Visual Studio Is Rendering Web Pages Twice In Browser?

Oct 14, 2010

my VS is rendering my ASP.NET pages twice in the default IE browser when I press "View in browser" or "Start without debugging" button.

View 1 Replies

C# Flow Chart Of Pages In Visual Studio?

Sep 9, 2010

how to put what i am looking for. The best i can describe it is a flowchart type of layout that shows your all your ASP.NET pages and how they are linked to one another.


----------- -----------
|main page| |error.asp|
----------- /----------
-----------/ ------------
| login.asp| |footer.asp|
------------ /-----------
---------/ ------------
---------- ------------
/ ------------
--/----------- |Nav bar.asp|
|Products.asp| -------------
etc etc..

Is there any built-in things like that or 3rd party software that does what i am looking to do above?

View 1 Replies

Visual Studio :: Can't View Pages In Browser

Jan 13, 2010

i have created a web project and i want to test it.when i click on debug or click on default page to view on browser , ASP.NET Web Development Server Works but nothing appear in my web browser . even i used internal browser ofVisual Studio 2008 but it shows this message :

Action canceled

View 4 Replies

Pages With 64 Bit Assembly In Visual Studio 2010?

Nov 3, 2010

I'm using a 64bit dll ( in an MVC app in VS 2010. The application runs and debugs fine, but all the aspx and ascx pages show errors when editing in Visual Studio 2010 and intellisense doesn't work. This is a VS2010 regression bug. Does anyone have a work around? (OR)Does anyone know of a free, reliable, production ready embeddable database that doesn't cause a 32/64 bit problem?More DetailsApparently this worked in Visual Studio 2008 and this has been is a known regression bug in Visual Studio 2010 for several months. I don't want to revert to VS 2008 and I don't want to debug in 32 bit mode.

I have web application that needs to debug and deploy as a 64 bit mode because it uses uses some unmanaged 64 bit dll's like Also, I prefer debugging in 64 bit mode because it allows us to test some high memory use cases. After a lot of fiddling, will deploy and run just fine. However all the aspx and ascx pages show errors and intellisense doesn't work when editing them in Visual Studio 2010. Apparently this worked in Visual Studio 2008 and this has been is a known problem in Visual Studio 2010 for months. I don't want to revert to VS 2008. There was a work around posted on SO here but it didn't work in my tests, limits debugging to 32bit mode, and also feels a bit hacky (I think it only works for VS Express style websites). Has anyone made this work in a web application or have a better work around?For those who are interested Visual Studio 2010 has two other problems with 64bit dlls that I have managed to work around.

Problem 1 - Cassini: Cassini can only debug in 32 bit modeSolution 1 - CassiniDev or Localhost: Debug using localhost or compile CassiniDev (an opensoure variant of cassini) in 64bit mode. I like the zero config simplicity of debugging a new web app with cassini so I used CassiniDev. You just stick the dlls in C:Program Files (x86)Common Filesmicrosoft sharedDevServer10.0 and it works (I recommended making a backup of the Cassini version you will be over writing).Problem 2 - MSTest: By default unit tests run with MSTest fail to load 64bit dlls.Solution 2 - AnyCPU & 64bit host process Instructions here, set local.testsettings to AnyCPU & 64bit host processI'm starting to think the whole setup is too little hacky and I'm on the verge of giving up and restructuring my application to not use a 64bit dll. I'm also really disappointed that Visual Studio 2010 caused all these problems. Can somebody make MS fix the regression bug they created?

View 1 Replies

Copyrights 2005-15, All rights reserved