Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2006, 11:28 PM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to miketayo
Default Embedding Files in Database with VB.NET

Hi,

I am in need of some urgent help with my file transfer program

i need to embed my files in the database so that i can move my db and know that my files are ok.

i need the code to use in vb.net to be able to save the file in the db.

thanks
 
Old December 8th, 2006, 08:05 AM
Authorized User
 
Join Date: Nov 2006
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ef1196
Default

What type of files are you wishing to save to the DB?



Best Regards,
Earl Francis
 
Old December 8th, 2006, 10:00 AM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to miketayo
Default

any file type


 
Old December 8th, 2006, 07:09 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What database system?
 
Old December 11th, 2006, 09:41 AM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to miketayo
Default

SQL Server 2005

 
Old December 15th, 2006, 02:46 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Oracle has a type BLOB (Binary Large OBject) which will accept the type of data you would find in a file; surely SQLServer does as well.

Open the file and read it into a column of that type. I would think that would do it.

What have you tried thus far, and what results have you met with?
 
Old December 27th, 2006, 08:53 AM
Registered User
 
Join Date: Jul 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to miketayo
Default

The problem is not inserting it through the db but converting the file to bytes in vb so as to use the memorystream to get the bytes and them save it to the db.
example
           Dim ms as memorystream
           dim arr() as bytes = ms.GetBuffer



 
Old February 25th, 2008, 09:18 AM
Authorized User
 
Join Date: Oct 2006
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

U can use binary data type to store file in sql server2005

With thanks
rajesh,
India
 
Old February 25th, 2008, 01:16 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I don’t follow. Files are stored in bytes. It seems you would be able to just read the file in binary format, and be done with it. I suppose if you want an intermediate storage, you could create an array of bytes, and read it into that.

Plus Rajesh seems to be indicating that SQL actully has an intrinsic column type designed to hold a file.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedding files in Database with VB.NET miketayo Classic ASP Basics 2 December 7th, 2006 06:54 PM
Execute VBS files via ASP.NET (VB.NET) Mario_Steiner ASP.NET 1.0 and 1.1 Professional 0 November 9th, 2005 07:49 AM
"Include files" in VB.net mike_abc Pro VB.NET 2002/2003 3 February 24th, 2005 10:44 AM
Embedding an Excel spreadsheet in a VB application James Diamond Pro VB.NET 2002/2003 3 April 21st, 2004 11:18 AM
Embedding SWF Files using FrontPage 2000 Ben Horne HTML Code Clinic 1 December 21st, 2003 01:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.