p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.

Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 26th, 2006, 03:23 PM
Registered User
 
Join Date: May 2006
Location: Rawalpindi, Punjab, Pakistan.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retriving Binay Image From SQL Server 2000 In VB 6

i want to retrive the image from SQL server 2000 image data type and want to display the image in the picture box of visual basic 6. i have added the image in SQL server 2000 but retrving is the problem can any one help me plz............

Ammar
__________________
Ammar
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 22nd, 2006, 04:09 PM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use ADO

Dim Flds As ADODB.Fields
    Dim fld As ADODB.Field
    Dim byteChunk() As Byte
    Dim strNote As String
    Dim Offset As Long
    Dim Totalsize As Long
    Dim Remainder As Long
    Dim NumOfChuncks As Long
    Dim CurrentRecPos As Long
    Dim FieldSize As Long
    Dim FileNumber As Integer
    Const HeaderSize As Long = 78
    Const ChunkSize As Long = 100
    Const TempFile As String = "tempfile.tmp"


FileNumber = FreeFile
                    Open TempFile For Binary Access Write Lock Write As FileNumber
                    Totalsize = FieldSize - HeaderSize ' Substract it from the total size.
                    byteChunk() = fld.GetChunk(HeaderSize) ' Get rid of the header.
                    NumOfChuncks = Totalsize \ ChunkSize
                    Remainder = Totalsize Mod ChunkSize
                    If Remainder > 0 Then
                        byteChunk() = fld.GetChunk(Remainder)
                        Put FileNumber, , byteChunk()
                    End If
                    Offset = Remainder
                    Do While Offset < Totalsize
                        byteChunk() = fld.GetChunk(ChunkSize)
                        Put FileNumber, , byteChunk()
                        Offset = Offset + ChunkSize
                    Loop
                    Close (FileNumber)
                    Image1.Picture = LoadPicture(TempFile)
                    Kill (TempFile)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Download in Image from Sql Server 2000 using asp surendraparashar Classic ASP Basics 0 December 16th, 2007 11:55 PM
retriving picture from database(sql) to <asp:image aspnet79434319 Classic ASP Basics 0 June 21st, 2005 02:29 AM
Saving image in SQL Server 2000 ashu_from_india ADO.NET 0 February 21st, 2005 01:10 PM
Beginning VB with SQL Server 2000 JohnAlex Pro VB Databases 2 June 29th, 2004 05:20 PM
VB Net and SQL Server 2000 hdmdev Wrox Book Feedback 1 July 22nd, 2003 05:55 PM



All times are GMT -4. The time now is 03:05 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc