ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 25th, 2012, 10:17 AM
sorigrafia sorigrafia is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2010
Posts: 3 sorigrafia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 2 sec
Reputation Power: 0
Pdf To - From Oracle Blob

{VS 2005 - 2.0 - VB)
Ciao a tutti...sto provando la lettura e la scrittura di files PDF in campi ORACLE BLOB.
Ho 2 domande semplici, sono nuovo dell' argomento gestione file.

1 - Per la scrittura ho trovato e sono riuscito in questo modo:

'Open file on disk
Dim txtFilepath As String = "Z:\TEST.PDF"

Dim fs As FileStream = New FileStream(txtFilepath, FileMode.Open, FileAccess.Read)
Dim r As BinaryReader = New BinaryReader(fs)
myConnection.Open()

Dim dati() As Byte = New Byte((fs.Length) - 1) {}
fs.Read(dati, 0, CType(fs.Length, Integer))
fs.Close()

Dim InsertCommand As String = "INSERT INTO TESTBLOB (ID, DESCRIZIONE, DATI) VALUES ('002','TESTBLOB',:PDF)"

Dim myCommand As OracleCommand = New OracleCommand(InsertCommand, myConnection)
Dim myParam As OracleParameter = myCommand.Parameters.Add("PDF", OracleType.Blob)
myParam.Value = dati

myCommand.ExecuteNonQuery()
myConnection.Close()
r.Close()
fs.Close()

A riguardo devo chiedervi: la selezione del file per ora l' ho fatta con l' oggetto FileUpload ma ho visto che NON VIENE LETTO DI DEFAULT TUTTO IL PERCORSO COMPLETO DEL FILE SELEZIONATO se da Internet Explorer (il pił usato dove devo rilasciare la app) se non viene abilitata la lettura completa dei file in upload (IE - Strumenti - Opzioni - Protezione - Livello Personalizzato - Includi il percorso locale durante il caricamento dei file in server --> ATTIVA).

1 DOMANDA: C' E' UN MODO MIGLIORE CHE LEGGA TUTTO IL PERCORSO DEL FILE IN UPLOAD PER POTERLO POI INERIRE NEL DB??

---------------------------------------------

2 - Per la lettura sono riuscito ed ho trovato in questo modo:

Dim myCommand As New OracleCommand("SELECT * FROM TESTBLOB WHERE ID = '001'", myConnection)
myConnection.Open()
Dim myReader As OracleDataReader = myCommand.ExecuteReader(System.Data.CommandBehavior.Default)
Try
While myReader.Read()
Dim myLob As OracleLob = myReader.GetOracleLob(myReader.GetOrdinal("DATI"))
If Not myLob.IsNull Then
Dim FN As String = myReader.GetString(myReader.GetOrdinal("DESCRIZIONE"))
Dim fs As FileStream = New FileStream("Z:\" + FN + ".pdf", FileMode.Create)
Dim w As BinaryWriter = New BinaryWriter(fs)
w.Write(myLob.Value)
w.Close()
fs.Close()

End If
End While
Finally
myReader.Close()
myConnection.Close()
End Try

Sono riuscito ma in questo modo il file viene scritto localmente!

2 DOMANDA: C' E' MODO DI VISUALIZZARE IL FILE PDF LETTO DAL CAMPO BLOB, SENZA DOVER SCRIVERE IL FILE LOCALMENTE/IN RETE?

grazie mille a chi mi riuscirą ad aiutare!

Reply With Quote
  #2  
Old June 25th, 2012, 05:25 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,235 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 14 h 27 m 16 sec
Reputation Power: 4445
Topic closed. Please re-post your question in English, thanks.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Pdf To - From Oracle Blob

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap