Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 7th, 2006, 11:28 PM
Registered User
 
Join Date: Jul 2005
Location: Ikeja, Lagos, Nigeria.
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
Reply With Quote
  #2 (permalink)  
Old December 8th, 2006, 08:05 AM
Authorized User
 
Join Date: Nov 2006
Location: , , USA.
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
Reply With Quote
  #3 (permalink)  
Old December 8th, 2006, 10:00 AM
Registered User
 
Join Date: Jul 2005
Location: Ikeja, Lagos, Nigeria.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to miketayo
Default

any file type


Reply With Quote
  #4 (permalink)  
Old December 8th, 2006, 07:09 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

What database system?
Reply With Quote
  #5 (permalink)  
Old December 11th, 2006, 09:41 AM
Registered User
 
Join Date: Jul 2005
Location: Ikeja, Lagos, Nigeria.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to miketayo
Default

SQL Server 2005

Reply With Quote
  #6 (permalink)  
Old December 15th, 2006, 02:46 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
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?
Reply With Quote
  #7 (permalink)  
Old December 27th, 2006, 08:53 AM
Registered User
 
Join Date: Jul 2005
Location: Ikeja, Lagos, Nigeria.
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



Reply With Quote
  #8 (permalink)  
Old February 25th, 2008, 09:18 AM
Authorized User
 
Join Date: Oct 2006
Location: Mumbai, , India.
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
Reply With Quote
  #9 (permalink)  
Old February 25th, 2008, 01:16 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:17 AM.


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