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
ADVERTISEMENT
Aug 21, 2000
Hi
Can anyone tell me how to store animage file into database?
Thanks
Peter
View 2 Replies
View Related
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
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
Nov 1, 2006
please mail me at lavkesh_kumar@yaho.com
View 2 Replies
View Related
Feb 16, 2008
Hello,I'm looking for a tutorial or some sample code to save a file in sql server with c#. So far I have not been able to find a anything I could use as most tutorials are in VB. I'm using the varbinary max type to store the file. The part I need help with is selecting the file and converting it using the Stream object, not the SQL insert statements. Thanks,Arnold
View 3 Replies
View Related
Feb 9, 2006
I have a table that I'm inserting a file into and using the Image data type to store the binary object. Now the code below works fine for files around 1.5 MB, but anything larger and it's like the code won't even execute and I get a Page Not found error.
I'm in the process of running some traces to find out what's going on in the backend, but I'm assuming there's something amiss with my code. The Image data type should handle files that size with no problem but for some reason it isn't.
Does anyone see anything wrong?
Thanks
Dim iLength As Integer = CType(File1.PostedFile.InputStream.Length, Integer)
If iLength = 0 Then Exit Sub 'not a valid file
Dim sContentType As String = File1.PostedFile.ContentType
Dim sFileName As String, i As Integer
Dim bytContent As Byte()
ReDim bytContent(iLength) 'byte array, set to file size
'strip the path off the filename
i = InStrRev(File1.PostedFile.FileName.Trim, "")
If i = 0 Then
sFileName = File1.PostedFile.FileName.Trim
Else
sFileName = Right(File1.PostedFile.FileName.Trim, Len(File1.PostedFile.FileName.Trim) - i)
End If
conn = New SqlConnection(eco)
conn.Open()
cmd = New SqlCommand("INSERT INTO ECO_Attachments (ECOID, FromType, DocName,OldRev,NewRev,NtLogin,DisplayName, FileName, FileSize, FileData, ContentType) VALUES (@ECOID, @FromType,@DocName,@OldRev,@NewRev,@NtLogin,@DisplayName, @FileName, @FileSize, @FileData, @ContentType) ")
cmd.Connection = conn
Try
File1.PostedFile.InputStream.Read(bytContent, 0, iLength)
With cmd
.Parameters.Add("@ECOID", SqlDbType.Int)
.Parameters.Add("@FromType", SqlDbType.NVarChar, 50)
.Parameters.Add("@DocName", SqlDbType.NVarChar, 250)
.Parameters.Add("@OldRev", SqlDbType.NVarChar, 50)
.Parameters.Add("@NewRev", SqlDbType.NVarChar, 50)
.Parameters.Add("@NTLogin", SqlDbType.NVarChar, 100)
.Parameters.Add("@DisplayName", SqlDbType.NVarChar, 200)
.Parameters.Add("@FileName", SqlDbType.NVarChar, 255)
.Parameters.Add("@FileSize", SqlDbType.Real)
.Parameters.Add("@FileData", SqlDbType.Image)
.Parameters.Add("@ContentType", SqlDbType.NVarChar, 50)
.Parameters("@ECOID").Value = ECOID
.Parameters("@FromType").Value = From
.Parameters("@DocName").Value = DocName
.Parameters("@OldRev").Value = OldRev
.Parameters("@NewRev").Value = NewRev
.Parameters("@NTLogin").Value = NTLogon
.Parameters("@DisplayName").Value = DisplayName
.Parameters("@FileName").Value = sFileName
.Parameters("@FileSize").Value = iLength
.Parameters("@FileData").Value = bytContent
.Parameters("@ContentType").Value = sContentType
.ExecuteNonQuery()
'.ExecuteScalar()
End With
Catch ex As Exception
Response.Write(ex)
'Handle your database error here
conn.Close()
End Try
View 1 Replies
View Related
Dec 17, 2007
Hi There,
Can I store flash files in the database. I have a table with one of the columns as varbinary datatype. Previously, I was saving images (as filebytes) into this column. But now I need to implement something to store the flash file. So, is it possible to store flash files in the database and retrieve them and display them in an asp.net page?
Thanks a lot for your suggestion!!
View 8 Replies
View Related
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
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
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
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
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
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
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
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
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
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
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
View Related
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
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
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
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
Dec 11, 2005
I need to write codes to access many image files and wave files and display them on the webpage. Both of these files are stored on the server (as many experts in this forum adviced) and their locations are in the SQL server database. About the wav files, I think I will have to convert them to MP3 first for fast delivery on internet. Since I am a newbie, any help would be appreciated.
Thanks,
View 14 Replies
View Related
Dec 22, 2000
Hi,
can we keep a file like word file or html file in the sql server database?
if yes, then can we search any thing in these stored file?
regards
mihir
View 2 Replies
View Related
Apr 16, 2006
Is there any way to store a binary or image file into a database record / save a binary or image record back into a file using Transact SQL? If yes, would the "image" data type be most suitable?
(As a background, I am working on a process that deals with incomign emails, and I am using SQL Mail for that purpose. The above is needed to deal with attachments that may come with emails, and which are saved in a physical file on the HDD).
Thanks a lot in advance...
View 3 Replies
View Related
Oct 10, 2007
What is the best way to store 100 of thousands of .jiff files (<5 MB each) to be used (creating and retreiving) in .net c# new application using sqlserver db.
We will also need to migrate existing files working with old VB application to .net c# application
So the next question will be to: what is the best way to migrate these files into new db/system
Please advice.
Thanks
View 4 Replies
View Related
Apr 10, 2008
Hey I currently have a foreach loop container working which scans a folder, loops through the files in this folder and then moves them to a new folder.
At the same time I also do an SQL insert into a table logging the details of the transfer.
What I would like to do next is to store the actual PDF in binary in my DB (varbinary format). How would I go about this ?
View 6 Replies
View Related
Feb 18, 2003
Can you guys give me any specific classes I should read about to implement the above? Any specific methods?
Any webpage I should read?
Thanks for your direction/help!
View 22 Replies
View Related
Oct 29, 2004
Hi,
Thanks in advance.
I need help(Tutorials or online links) regarding storing and retrieval of files in Sql server (BLOB) using ASP.net and C#.
Secondly,Is it possible to search file in BLOB using SQL server Full text search service.
View 1 Replies
View Related
Mar 8, 2006
how can i stored audio file in Sql Server, so that i can loop my web page to fill the table with a link to download the audio. What will be the best way to achieve that.
View 1 Replies
View Related
Jul 23, 2005
Hi folks,Is it possible to store Binary Files in MS SQL 2000 ??? Say I have a100K PDF or a 150K word document. Is it possible to store this in afield in MS SQL and pull it out somehow? We're using ColdFusion on theserver on Apache.Thanks,Ringo
View 3 Replies
View Related
Nov 29, 2006
Hi There,
I am new to VC# and SQL Express. I am currently trying to find a way to store user selected files into SQL Express. I am using a column with the varbinary(MAX) data type. My current thought is to give the user a open file dialog box, and let them select the file they want to upload. On closing this dialog box, I convert the file selected into a file stream and insert into SQL Express.
Is this method a good one? If anyone else can give me pointers or hints to better methods, please do!
Thanks,
Ke
View 4 Replies
View Related