GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  VB.NET
Go To First  |  Previous Question  |  Next Question 
 VB.NET  |  Question 24 of 60    Print  
how to store/retrive images into/from oracle database using vb.net

  
Total Answers and Comments: 4 Last Update: December 02, 2006     Asked by: amrita 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
October 18, 2006 15:10:56   #1  
manju        

RE: how to store/retrive images into/from oracle datab...
HiThere r 2 ways in sql server1.Binary encodind2.path storage
 
Is this answer useful? Yes | No
November 07, 2006 04:15:43   #2  
Niraj        

RE: how to store/retrive images into/from oracle datab...

Hi you can ado streams which is available in ado 2.5 or above. I m giving you a source code of vb using sql server but this will be very much helpful for you. In case if u still have problems then pls contact.

Niraj

Code for storing Image

Dim rs As New ADODB.Recordset
Dim mstream As New ADODB.Stream

rs.Open select * from StyleImage where styleNo ' & TxtStyleNo.Text & ' db adOpenDynamic adLockOptimistic

If rs.EOF False Then
MsgBox Stle Already Exist in Database
Exit Sub
End If

db.Execute exec insertintostyleimage & MCId & & SCId & & GId & & CompanyId & ' & TxtStyleNo & ' ' & TxtStyleDesc & ' ' & TxtStyleCost & ' ' & Img1.Picture & ' ' & Usercd & ' ' & Img2.Picture & ' ' & cmbexportername.Text & ' ' & txtexporterstyleno.Text & '

rs.Open select * from StyleImage where styleNo ' & TxtStyleNo.Text & ' db adOpenDynamic adLockOptimistic

With rs
If .RecordCount <> 0 And Img1.Picture <> LoadPicture( ) And Img2.Picture <> LoadPicture( ) Then

mstream.Type adTypeBinary
mstream.Open
fpath CD1.FileName
mstream.LoadFromFile fpath
.Fields( imagefilebig ).Value mstream.Read
fpath CD2.FileName
mstream.LoadFromFile fpath
.Fields( imagefilesmall ).Value mstream.Read
.Update
mstream.Close

End If
.Close
End With

code for retriving images

Dim rscat As New ADODB.Recordset
Dim mstream As New ADODB.Stream

rscat.Open select styleimage.* (select companyname from exporter where companyid styleimage.exporterid)as expname from styleimage where companyid & CompanyId & and maincatid & MCId & and subcatid & SCId & and catgroupid & GId & and styleno ' & CmbStyleNo & ' db adOpenDynamic adLockOptimistic
If rscat.RecordCount > 0 Then
mstream.Type adTypeBinary
Set Img2.Picture LoadPicture( )
If mstream.State 1 Then mstream.Close
mstream.Open
If IsNull(rscat.Fields( Imagefilesmall )) Then
Else
mstream.Write rscat.Fields( Imagefilesmall ).Value
If mstream.Size > 1 Then
mstream.SaveToFile App.Path & temp.jpeg adSaveCreateOverWrite
CD1.FileName App.Path & temp.jpeg
Img2.Picture LoadPicture(CD1.FileName)
mstream.Close
End If
End If


 
Is this answer useful? Yes | No
November 13, 2006 02:39:21   #3  
priti sharma Member Since: November 2006   Contribution: 1    

RE: how to store/retrive images into/from oracle datab...
please explain by words.....
 
Is this answer useful? Yes | No
December 02, 2006 05:59:27   #4  
chirag        

RE: how to store/retrive images into/from oracle datab...
i want to store word/excel/text file into sql server database from vb.net and also want to retrieve it give source code and explanation
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape