adduing pics and info from a DB to an asp.net page

fguihen

Junior Contributor
Joined
Nov 10, 2003
Messages
248
Location
Eire
sorry for asking this as im sure you heard it all before, but im real used to creating pages with old asp, where i used "islands of code" which wrote html and any info contained in a DB out as a string, which was recognised by the browser and desplayed as a web page. now with asp.net im stumped. ive tried to follow tutorials but i dont know how to addata contained in a DB to a web page.eg..i have paths to pictures in a database. i want to display theese pics on my web page, but i dont know how to . can anyone just show me the code to do this, or point me to a good tutorial ( not a microsoft tutorial). thank you all...
 
Hopefuly you're able to get a DataReader going:

Loop your dr with something like this...

'option 1 using an html image tag
While dr.Read
<img src=" & Convert.toString(dr.("myfieldWithImagePath")) & " />"
end while

'Option 2 using an ASP Image control
While dr.Read
dim img as new webcontrols.Image
me.controls.add(img)
img.ImageUrl = Convert.toString(dr.("myfieldWithImagePath"))
end while
 
Back
Top