Storing BitmapSource Image Data Into SQL CE

Jan 30, 2008



Hi,

I'm storing thumbnails in SQL CE and accessing them from my WPF application. The save seems to take place ok and there's binary data in the image field however when it comes back out it appears to be corrupted somehow. Can someone have a look at the code below and verify I'm doing the conversion correctly before storing in my image field? Thanks!

- Roland




Code Snippet
private byte[] GetArrayOfPixels(BitmapSource bitmapsource)
{
Int32 stride = bitmapsource.PixelWidth * bitmapsource.Format.BitsPerPixel / 8;
Int32 ByteSize = stride * bitmapsource.PixelHeight * bitmapsource.Format.BitsPerPixel / 8;
byte[] arrayofpixel = new byte[ByteSize];
bitmapsource.CopyPixels(arrayofpixel, stride, 0);
return arrayofpixel;
}



//I assign the byte array returned to my datatable like so:

MediaAsset asset = new MediaAsset(){

Thumbnail =
new Binary(GetArrayOfPixels(Thumbnail as BitmapSource));
}

//then I insert it into my tables collection
myDB.MediaAssets.InsertOnSubmit(asset);

//and submit the change
myDB.SubmitChanges();




Am I not getting that pixel array correctly for storage?

Thanks for the help!

Roland

View 1 Replies


ADVERTISEMENT

Sending Uploaded Image To Data Access Class When Storing Image In SQL Server 2005

Apr 20, 2007

I am using the 3-tiered architecture design (presentation, business laws, and data acess layers). I am stuck on how to send the image the user selects in the upload file control to the BLL and then to the DAL because the DAL does all the inserts into the database. I would like to be able to check the file type in the BLL to make sure the file being uploaded is indeed a picture. Is there a way I can send the location of the file to the BLL, check the filetype, then upload the file and have the DAL insert the image into the database? I have seen examples where people use streams to upload the file directly from their presentation layer, but I would like to keep everything seperated in the three classes if possible. I also wasn't sure what variable type the image would be in the function in the BLL that receive the image from the PL. If there are any examples or tips anyone can give me that would be appreciated.

View 2 Replies View Related

Storing Data In Image Field

Jul 20, 2005

I have a very large array of floating point numbers which I am tryingtostore in an image type field. I am using the dataset class todirectly enter the data but am having trouble trying to get this typeinto the image field. I guess the question is how do I get a largefloating point array into an image (byte)field of a database using thedataset class for new row entry.Thanks

View 1 Replies View Related

Storing Pictures In Image Data Type

Apr 17, 2001

Hey all,

Just starting to investigate this. I need to store digital pictures in my database for use in claims and disputes. I have played a bit with the image datatype but notice that one picture takes up 1Mb as a TIFF and 3Mb as a JPEG. Does anybody work with this stuff and if you do what is the best picture format to use in regards to keeping clarity but minimizing size used in the db. Is there any load conversion routines that would shrink the size of the file.

Any suggestions or comments on this topic are appreciated.

Thx. Kelsey

View 1 Replies View Related

Storing Pictures In Image Data Type

Apr 17, 2001

Hey all,

Just starting to investigate this. I need to store digital pictures in my database for use in claims and disputes. I have played a bit with the image datatype but notice that one picture takes up 1Mb as a TIFF and 3Mb as a JPEG. Does anybody work with this stuff and if you do what is the best picture format to use in regards to keeping clarity but minimizing size used in the db. Is there any load conversion routines that would shrink the size of the file.

Any suggestions or comments on this topic are appreciated.

Thx. Kelsey

View 1 Replies View Related

Help In Storing Binary To Image Data Type

Aug 23, 2007

Hi. how can i store binary data to another field with image data types.


here is my sample code


--note: [CUD_DOCUMENT] and [RES_DOCUMENT] are image data type

DECLARE @CUD_DOCUMENT binary

SELECT @CUD_DOCUMENT = CUD_DOCUMENT FROM CUD_CONTINUOUS_UPLOAD_DOCUMENTS

INSERT INTO [RES_RESUMES](
[RES_DOCUMENT] -- image data type
) VALUES (
@CUD_DOCUMENT)

thnx for the help.

View 2 Replies View Related

Image Type Storing

May 6, 2000

1. How can I upload new pictures into the database through the browser.
2. Can you describe how the new picture of the product would be uploaded into the database.
3. How do you handle different formats that pictures come in gif, tif, jpeg,
etc.

4. How can you say that SQL server does support images well, because on
microsoft site they loaded up the satellite data of the earth into sqlserver
which is only picture data


Ashu

View 1 Replies View Related

Storing Image Files

Aug 21, 2000

Hi

Can anyone tell me how to store animage file into database?

Thanks
Peter

View 2 Replies View Related

Storing Image In Database

Dec 15, 2004

How do you store an image in a database? I know this is not the preferred method for storing images but would like to know anyways…thanks.

View 1 Replies View Related

Storing Image And Other Files In Db

May 1, 2008

What are the negatives, challenges and issues going to be if we choose to store 300-1000 GB worth of image, xml and PDF files (avg size 1 mb) in SQL server 2005 db.

View 1 Replies View Related

Storing And Retrieving Image

Jun 13, 2008

Kindly descibe how i can save image and retieve images with vb form. Also include vb code to execute the process.

View 2 Replies View Related

Question About Storing An Image

Dec 1, 2006

Rahmat Ali writes "Que: How can we store an Image in Sql Server 2000 and retrive in Data Grid?"

View 3 Replies View Related

Too Many Arguments Storing Image

May 25, 2008

Hi all,

I have got this issue when I am trying to store an Image on a database through a stored procedure. I give you the code in C# and the stored procedure



Code Snippet

//I have got these two variables with the ID(foreign key) and the array of bytes of the Image (the values are OK)
int ID_Inmueble
byte[] imagen -- dimension 26246

SqlConnection conn = new SqlConnection(...) //The conexion works fine (I tested it).

SqlCommand cmd = new SqlCommand();

SqlParameter[] param = new SqlParameter[2];

cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "InsertaUnaFoto";
cmd.Connection = conn;


param[0] = new SqlParameter("@ID_Inmueble", SqlDbType.BigInt);
param[0].Value = ID_Inmueble;




param[1] = new SqlParameter("@Foto", SqlDbType.Image);
param[1].Value = imagen;

cmd.Parameters.AddRange(param);

SqlDataAdapter da = new SqlDataAdapter(conexion.GetSqlCommand());

da.Fill(ds); //here I got the error


The stored Procedure

T


Code Snippet


ALTER PROCEDURE dbo.InsertaUnaFoto
(@ID_Inmueble bigint,
@Foto Image)
AS
INSERT into Fotos (ID_Inmueble, Foto) values (@ID_Inmueble, @Foto)



Many Thanks,

View 3 Replies View Related

Storing The Image Urls In Database

Mar 29, 2007

hi friends,
i want to show images in repeater control dynamically.
i want to store the image url in database
like i have stored the images on onefolder c:images this will contain images
how can i store and use the urls in database
or atleast how can i show the images from the folder dynamically
please help me out

View 3 Replies View Related

Image Storing In SQL Server 2000

Apr 15, 2007

HI,
Kindly Guide me how to store picture files in SQL server 2000 using Visual studio 2005
 
 

View 3 Replies View Related

Storing An Image Into Sql Server Database

Jul 23, 2005

Is there any way of storing an image file into a specific Table .It would be of great help for me if i come to know something about it.

View 2 Replies View Related

Storing Pdfs In An Image Field

Jul 23, 2005

I am using an image datatype to store multiple filetypes includeing plaintext data. it works except for pdf Data. When I retrieve the the filecouldn't be opened in acrobat reader and the file was 3KB bigger than theoriginal.Any suggestions would be helpful.

View 3 Replies View Related

Storing Files In Image Columns In 2005

Jul 10, 2006

I did some quick Googling and didn't find the article of my dreams here. Any experience with storing files in the db in 2005? Any opinions?

Here's the deal. We have our new 'Enterprise' software being designed and written in St. Petersburg (not FL) and I'm reviewing the design for dealing with letters and forms that are generated as hard copy from our business (by the thousands per month) and sent to clients for review, signature etc. Then they are returned by fax or snail mail.

The current design has all of these being stored in image data type columns in the database--storing saved files of the actual outgoing stuff and saved files of the stuff that comes in (scanned copies or the files from our fax server).

This screams 'BAD IDEA' based on our experience doing this in SQL Server 2000. We get things like 23 page faxes from Dr's offices, large packets of FMLA forms returned, etc. In 2000 they tended to get rather large when stored in the DB and caused us all kinds of headaches when Microsoft changed how it recognized and displayed certain types of files, e.g. tiffs.

Further, the outgoing stuff is largely boilerplate with added fields from the db--name, address, a few dates. My proposed design for outbound notifications and forms was to keep only references to the template used, the date created, and an id to link it to the personal info of the schmoe to whom it was sent--essentially, store which document template and then just enough data to map to the variable content that is pulled from the db. Then you can recreate the file that was printed and mailed at any time in the future, but you don't actually save the .doc (or Word .xml) anywhere, not in the file system, not in the db.

The current developers feel this is way too much work to design--and it is certainly more effort than just generating .docs/.xml files via a merge with Word and then stuffing those into the database. They also argue that having them in the db makes them 'more secure' and more 'accessible' to users around the globe.

Does anyone know if the image storage is any better in 2005 than 2000? The .docs & .tifs we used to store just about tripled in size when we put them in the db in 2000. Plus there were the defrag issues and generally it was an unsatisfying experience.

Does anyone know what the advantages/disadvantages of generating Word .xml files might be? Can they be stored as xml data type in SQL Server? Perhaps this is a better option?

If anyone has the time to digest this, please send opinions.

Thanks!

View 3 Replies View Related

Storing File As Binary Image Into SQL Server

Dec 21, 2005

I am using FileUpload control in ASP.net 2.0 to upload files and store them into SQL server database as an image. I am fine with MS office files, image files and etc. We have Product Center (Proe) engineering software to configure parts and the files generated through this software have PLT extension when I store these files, the file type is Plian/text. I am using Fileupload.PostedFile.Content to get the file type. How can I store PLT, TIF files in SQL server? Please help.

View 12 Replies View Related

Storing Image In Sql Server 2005 In Binary Format?

Nov 1, 2006

please mail me at lavkesh_kumar@yaho.com

View 2 Replies View Related

Which Is Better? Storing Data In The Database OR Storing It In The File System

Dec 29, 2006

Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?    

View 6 Replies View Related

Storing Data

Jun 20, 2006

Hi again.

How do I store in SQL SERVER with 2 decimal places?

I set Data Type to Decimal with Scale set to 4 and Precision 19. But this doesn't work.

Any ideas? Thanks.

View 1 Replies View Related

Help Me Out For Storing More Data

Jul 16, 2006

CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [varchar] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
GO

using this script i have created my blog table.

and a procedure given below. i am using to insert data in it.


CREATE PROCEDURE SP_BlogAdd

@blog_title nvarchar(500),
@blog_desc_full varchar(8000),
@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)

AS

INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)
GO

now, the problem i m facing is.
i am using varchar datatype for [blog_desc_full] [varchar] (8000).

i want more than this size to store data in it.

please give me some detailed code.

i tried text datatype but i didnt succeed. how to use text datatype.
i replaced with text datatype.but in length i couldnt type. it shows only 16.

Please help me out.

regards,
ASIF

View 1 Replies View Related

Help Me Out For Storing More Data

Jul 16, 2006

CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [varchar] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
GO

using this script i have created my blog table.

and a procedure given below. i am using to insert data in it.


CREATE PROCEDURE SP_BlogAdd

@blog_title nvarchar(500),
@blog_desc_full varchar(8000),
@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)

AS

INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)
GO

now, the problem i m facing is.
i am using varchar datatype for [blog_desc_full] [varchar] (8000).

i want more than this size to store data in it.

please give me some detailed code.

i tried text datatype but i didnt succeed. how to use text datatype.
i replaced with text datatype.but in length i couldnt type. it shows only 16.

Please help me out.

regards,
ASIF

View 1 Replies View Related

How To Convert To Regular Text, Data Stored In Image Data Type Field ????

Jul 20, 2005

Hi,This is driving me nuts, I have a table that stores notes regarding anoperation in an IMAGE data type field in MS SQL Server 2000.I can read and write no problem using Access using the StrConv function andI can Update the field correctly in T-SQL using:DECLARE @ptrval varbinary(16)SELECT @ptrval = TEXTPTR(BITS_data)FROM mytable_BINARY WHERE ID = 'RB215'WRITETEXT OPERATION_BINARY.BITS @ptrval 'My notes for this operation'However, I just can not seem to be able to convert back to text theinformation once it is stored using T-SQL.My selects keep returning bin data.How to do this! Thanks for your help.SD

View 1 Replies View Related

Move Text Data (not A File) Into An Image Data Type

Mar 11, 2008



The ERP manufacturer used an image data type to store large text data fields. I am trying to move these data types from one database to another database using either Sql Queries or MS Access. I can cast them as an 8000 char varchar to read them directly but have no luck importing into these image data fields.

Access and Crystal are not able to read these fields directly.

Any suggestions? Most information about these fields has to do with loading files but I am just moving data.

Thanks,

Ray

View 1 Replies View Related

Storing Formatted Data

Jan 22, 2007

I have a table for articles that I want as
the basis for a blog.  I have a field of description where the actual
article will go, I have only ever really
used tables to put in 'blocks' of text, how would I go about storing/displaying
data that is in my database table in a more formatted way, for example line
breaks, indents etc?

View 4 Replies View Related

Data Storing Problem......

May 11, 2007

Hi everyone,
I have some data which is in korean Language and i want to store that data in sql server 2000 table's row.But i am not able to store it.
When i try to store it then it display me square box in table.
Does anybody have any idea about this matter?
Plz reply me back as soon as possible.
Thanks
-------Nimesh Patel

View 6 Replies View Related

Storing Vs Calculating Data

Dec 19, 2007

Hi, I'm in the process of creating a database table and was wondering if it's better to store calculated values or recalculate them each time. So for example, I am creating a table that stores articles and then a table to store the pages to the article. If a new page is added should I update the pages field in the articles table or should I calculate the number of pages for an article when it's queried? Thanks,John 

View 3 Replies View Related

Storing Historical Data?

Apr 7, 2008

From what I've read this is called 'slowly changing dimensions'. Bassically the system I'm working on needs to store the history of certain data so that at any time a user can look up an old project and view it exactly as is, even though the associated parts might have had certain changes over time.  From what I can tell Type 2 ( current and historical records are stored in the same table) seems to  be the most popular.  Type 4 (current records in one table and historical records in a seperate history table) seems like it would also work but I've been unable to find any articles comparing the two.  Does anybody have any info on the dis/advantages of one v.s. the other?

View 3 Replies View Related

What Is The Use Of Storing Data In 2 Database ? And How To Do That ?

Mar 5, 2008





Can I know answer of this question ? in detail explanation.

View 1 Replies View Related

Storing Staging Data As XML In SQL 2000.

Aug 25, 2005

Scenario:
We want to stage all data coming into our database from various
applications.  We have a generic control where all data goes
through to get to the database.

We want have the data staged in a 'staging database'.  My question
is, what would be the best way to store the staging database in the
database.

I'm thinking storing it as XML in a SQL column.  The reason for
this is because the data could change from application to
application.  It would be impossible to create a relational table
because maintenance would be a nightmare.

Has anyone ever done something like this.  Would you save the node names in another table in SQL?

Any help would be appreciated as I'm new to XML.

Thanks,

ScAndal

View 1 Replies View Related

Question About Storing Data In Tables

Dec 15, 2005

I am trying to make my tables so that when data is entered using a formview even if a textbox is left blank there is still a value like for example NA entered into that field.  Is that possible?
also in the column properties under general what is the Default value or binding?
 
 

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved