none
Image Store in Sql Server RRS feed

  • Question

  • multiple image Store in database using asp.net fileuploader. but it's its store in sql server Image data Type.And fetch the image on page. 
    ujjwal 
    • Moved by Bob Beauchemin Saturday, July 2, 2011 2:14 AM Moved to a more appropriate forum. Also may be useful to post to ASP.NET forum (From:.NET Framework inside SQL Server)
    Friday, July 1, 2011 9:50 AM

Answers

  • Hi,

    I assume you want to store images in sql server. In this case use the varbinary(max) data type, or use filestream. ASP.NET side create a handler returning the binary and specify the mime type for it. This can be set for the image control source.

    here is a sample table I was using in the past:

    CREATE TABLE [dbo].[Content](
    	[ContentID] [int] IDENTITY(1,1) NOT NULL,
    	[ContentName] [nvarchar](255) NULL,
    	[ContentParent] [int] NULL,
    	[ContentMIMEType] [varchar](255) NULL,
    	[ContentIsDirectory] [bit] NULL,
    	[ContentSize] [int] NULL,
    	[ContentBinary] [varbinary](max) NULL
    
    


    I hope it helps.

    J.


    There are 10 type of people. Those who understand binary and those who do not.
    Friday, July 1, 2011 10:28 AM

All replies

  • Hi,

    I assume you want to store images in sql server. In this case use the varbinary(max) data type, or use filestream. ASP.NET side create a handler returning the binary and specify the mime type for it. This can be set for the image control source.

    here is a sample table I was using in the past:

    CREATE TABLE [dbo].[Content](
    	[ContentID] [int] IDENTITY(1,1) NOT NULL,
    	[ContentName] [nvarchar](255) NULL,
    	[ContentParent] [int] NULL,
    	[ContentMIMEType] [varchar](255) NULL,
    	[ContentIsDirectory] [bit] NULL,
    	[ContentSize] [int] NULL,
    	[ContentBinary] [varbinary](max) NULL
    
    


    I hope it helps.

    J.


    There are 10 type of people. Those who understand binary and those who do not.
    Friday, July 1, 2011 10:28 AM
  • i known convert the image in binary format and save it in varbinary(max) sql datatype. But i understand why include the image data type in sql server

    and   save image in image datatype.


    ujjwal
    Friday, July 1, 2011 9:00 PM
  • i known convert the image in binary format and save it in varbinary(max) sql datatype. But i understand why include the image data type in sql server

    and   save image in image datatype.


    ujjwal


    Hi ujjwal,

    As far as I know, SQL Server doesn't support raster spatial data specifically, though you can store any kind of image in SQL Server as a binary representation using the varbinary(max) datatype.

    If you want to know more I recommend you to post in the SQL Server Forum for better support. And Janos's reply does answer your question, could you please mark it as answer?

    I hope this can help you.

     

    have a nice day,


    Jackie Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 5, 2011 6:30 AM
    Moderator