ASP.NET Framework (VB)

1 view
Skip to first unread message

Ling

unread,
Nov 11, 2009, 7:17:51 AM11/11/09
to Super Mondays
Good Afternoon everyone,

My name is Ling and I am working in Visual Studio 2008 Pro Ed using VB
coding. I am having problems with the following and would like the
coding examples for it (if possible).

The problem(s) are:
1.Upload and Save: Storing images into table db and retrieving it to
display (e.g. Dj table includes an image type) – so far I have a table
created to store Dj’s details such as name, telephone and email
address. Then a gridview has been created to display the records but I
am not sure how to include a photograph (image).

2. In Gridview, upon selecting an individual record it should display
the full info (e.g. selecting a Dj then it will show the Dj's full
details, events, etc)

If you need further info, please don't hesitate to ask,
Thank You,
Ling

Kristian Lunde

unread,
Nov 11, 2009, 8:22:15 AM11/11/09
to super-...@googlegroups.com
Hi Ling

I am no ASP developer so I cant really give you any coding examples.

You should never store the actual images in the database, store images
and files in the file system and keep a reference to them in the
database. This means that you should have the image field in the
database table as a char or a varchar rather than having the image
field as a BLOB data type.

Good luck.

Kristian

Steven Woods

unread,
Nov 11, 2009, 8:29:40 AM11/11/09
to super-...@googlegroups.com
I can send you a C# class I use that you might be able to adapt to VB, but again it doesn't store the image in the database, only a reference to the filename.

2009/11/11 Kristian Lunde <kr.l...@gmail.com>

Ling

unread,
Nov 11, 2009, 8:27:22 AM11/11/09
to super-...@googlegroups.com
Hello Kristian,
 
So do you think it is best that i save images in a file, let's call it Image then in my database i just put like a link retrieving it from that file?
 
Thank You for your response,
Ling

Alistair MacDonald

unread,
Nov 11, 2009, 8:31:10 AM11/11/09
to super-...@googlegroups.com
Hi Ling,

I would just like to back up Kristian's advice.

Out of interest what it the application you are trying to build?

Alistair


2009/11/11 Kristian Lunde <kr.l...@gmail.com>:

Ling

unread,
Nov 11, 2009, 8:36:23 AM11/11/09
to super-...@googlegroups.com
Hello Steven,
 
That will be good, I can have a look at how it is used. You dont mind ?
 
Thank You so much,
Ling

Kristian Lunde

unread,
Nov 11, 2009, 8:39:37 AM11/11/09
to super-...@googlegroups.com
Hi, 

Well, have a directory on your server where you store each image as a separate file. In your database table you then have a colum (named for instance "image") where you keep the name of the file. You can keep the full path of the image in your application logic, which makes it easier to change location of the image directory in the future if needed. 

Kristian

Ross Dargan

unread,
Nov 11, 2009, 8:40:20 AM11/11/09
to super-...@googlegroups.com
Hi Ling

Few things.

If you are using Sql 2008 you can store images on the database safely (as it can be configured to redirect the files and store them on the hard drive).

Where do you want it to show the full dj details? Perhaps a mock up image would be good.

Thanks

Ross

Ling

unread,
Nov 11, 2009, 8:47:55 AM11/11/09
to super-...@googlegroups.com
Hello Ross,
 
I am using SQL 2008 and thats great advice about the image, in terms of showing the full dj details it would be on another webpage. The admin would input the details for the user to see on the website where the can select a specific dj to view, once clicked the user can then see the full spec of that dj they have selected.

Ling

unread,
Nov 11, 2009, 8:49:45 AM11/11/09
to super-...@googlegroups.com
Hello Alistair,
 
I am building a clubbing website where the admin would provide details such as Djs. The problem i have is uploading the images into the db table and then retrieving it where the user can view the available Djs then selecting a specific one to full the full spec of that particular Dj.

Ling

unread,
Nov 11, 2009, 8:51:56 AM11/11/09
to super-...@googlegroups.com
To ross,
 
That is ideal if i was for one thing such as Dj, but i have additional tables that require the same thing hence it would be easier if i could store it into the db table. So that Dj images would be stored in the Dj table and then Club images in Club table if you know what i mean ?

Steven Woods

unread,
Nov 11, 2009, 8:59:07 AM11/11/09
to super-...@googlegroups.com
Maybe you should keep the images (or image references) in a seperate table too, each row referenced by a DJ.ID so you could have multiple images in the future.

Steve

2009/11/11 Ling <love...@googlemail.com>

Ross Dargan

unread,
Nov 11, 2009, 9:02:55 AM11/11/09
to super-...@googlegroups.com
Hi Ling

If you want to view the details on another page then that's pretty straight
forward. On your grid view add a template column and use normal html with
using the dj id to go to the details page:

http://devpinoy.org/blogs/keithrull/archive/2006/09/10/How-To_3A00_-Use-a-H=
yperLink-control-inside-a-GridView.aspx

If you want to be fancier you can do some url rewriting for better SEO - a
bit of googling should help with that.

This shows how to store/and retrieve images from the DB:
http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx

BUT as others had advised this is generally a very bad idea, and personally
I would only do this if you are using sql 2008 with FILESTREAM turned on.
You can find more info about that here:
http://technet.microsoft.com/en-us/library/bb933993.aspx

Thanks

Ross

On Wed, Nov 11, 2009 at 2:01 PM, Ross Dargan <ro...@the-dargans.co.uk> wrote:
Hi Ling

If you want to view the details on another page then that's pretty straight forward. On your grid view add a template column and use normal html with using the dj id to go to the details page:


If you want to be fancier you can do some url rewriting for better SEO - a bit of googling should help with that.

This shows how to store/and retrieve images from the DB:

BUT as others had advised this is generally a very bad idea, and personally I would only do this if you are using sql 2008 with FILESTREAM turned on. You can find more info about that here: http://technet.microsoft.com/en-us/library/bb933993.aspx

Thanks

Ross

Ling

unread,
Nov 11, 2009, 9:05:14 AM11/11/09
to super-...@googlegroups.com
So store all the images in one table then pick them out to different tables? Is that easier?

Ling

unread,
Nov 11, 2009, 9:07:06 AM11/11/09
to super-...@googlegroups.com
This first link does not work, well it does but the thing you trying to show me has been removed or something =_="

LINGsCARS

unread,
Nov 11, 2009, 9:07:24 AM11/11/09
to Super Mondays
Just to make clear, this Ling is not me.

I am Ling Valentine and I run LINGsCARS.com. My email is
@LINGsCARS.com

Just for avoidance of doubt :)

Ling Valentine

Ling

unread,
Nov 11, 2009, 9:10:37 AM11/11/09
to super-...@googlegroups.com
Um .... ?? confused ...

Ross Dargan

unread,
Nov 11, 2009, 9:11:41 AM11/11/09
to super-...@googlegroups.com

Alex Kavanagh

unread,
Nov 11, 2009, 9:12:58 AM11/11/09
to super-...@googlegroups.com
Oh, don't be.  We now have two Lings on this list: you and Ling Valentine of LINGs CARS.  As Ling is an unusual name (on this list) people might have thought you were both the same person.  I certainly did.  Sorry for the confusion.

Cheers
Alex.


Ling wrote, On 11/11/09 14:10:
-- 
Alex Kavanagh
Tinwood Ltd  --  Open Source Information & Communications Solutions
Delivering Freedom, Creating Value
w: www.tinwood.com
e: alex.k...@tinwood.com
a: 20 Sefton Ave, NE6 5QR, Company No: 5233914 (Eng & Wales), VAT No: GB 874 8669 54

Sorry if you got this by mistake - please accept our apologies; 
please let us know that this message has gone astray so we don't 
do it again. Thanks.

Ling

unread,
Nov 11, 2009, 9:14:12 AM11/11/09
to super-...@googlegroups.com
Sweet :) thank you
Reply all
Reply to author
Forward
0 new messages