Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
| 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
 
Old February 3rd, 2007, 06:58 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How To Read And Add Image to Sql 2000 ???

How To Read And Add Image to Sql 2000 ???
By using vb.net 2003 code (not script)

thanks


Mr.Nsr
 
Old February 5th, 2007, 08:34 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

Here is the methodology that I used:

1.) The data type for your table should be "IMAGE".
2.) The following code will format your image so it can be saved:
        Dim fs As New FileStream(strFileName, FileMode.Open)
        Dim Data() As Byte = New [Byte](fs.Length) {}
        fs.Read(Data, 0, fs.Length)

        '* Your stored procedure code here...

3.) The following code will format your image so it can be displayed:
        '* Your stored procedure code here...
        '* In this case I used a DataReader

        Dim bits As Byte() = CType(.Item(strFieldName), Byte())
        Dim MemoryBits As New MemoryStream(bits)
        Dim bitmap As New Bitmap(MemoryBits)
        PictureBox1.Image = bitmap

Hope this helps.





Best Regards,
Earl Francis




Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert image in sql 2000 mangala SQL Server 2000 18 December 17th, 2007 06:11 AM
How to Add and Read Image ?? nsr2007nsr VB.NET 2002/2003 Basics 1 February 20th, 2007 08:26 AM
Add records from a DataGridView to SQL Server 2000 VS2005 Visual Basic 2005 Basics 2 November 27th, 2006 08:32 AM
Read SQL Server 2000 files into MS-Access slewis4 SQL Server 2000 8 March 1st, 2006 04:21 PM





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