J
Joris De Groote
Hi,
I have a small webpage that reads a file from sql server 2000 database and
opens it (added the code at the end of this question). Everything works, but
the file opens adobe acrobat reader in a new application. However, I want to
open the file in ie, so I don't get another box and everything.
How can I do this?
Thanks Joris
Private Sub DocumentOpenen()
Dim connectionString As String = "Server=VHTI2006\VHTITEST;Initial
Catalog=STS_VHTI2006_1_21001;Trusted_Connection=True"
Dim strSQL As String = "SELECT Content from Docs where LeafName ='" &
Documentnaam & "'"
Dim cnnDatabase As New SqlConnection(connectionString)
Dim myCommand As SqlCommand = New SqlCommand(strSQL, cnnDatabase)
Try
myCommand.CommandTimeout = 500
cnnDatabase.Open()
Dim dreader As SqlDataReader = myCommand.ExecuteReader()
If (dreader.Read()) Then
Response.ContentType = "application/pdf"
Response.BinaryWrite(dreader("Content"))
End If
Catch ex As Exception
Me.Label1.Text = ex.ToString
Finally
cnnDatabase.Close()
End Try
I have a small webpage that reads a file from sql server 2000 database and
opens it (added the code at the end of this question). Everything works, but
the file opens adobe acrobat reader in a new application. However, I want to
open the file in ie, so I don't get another box and everything.
How can I do this?
Thanks Joris
Private Sub DocumentOpenen()
Dim connectionString As String = "Server=VHTI2006\VHTITEST;Initial
Catalog=STS_VHTI2006_1_21001;Trusted_Connection=True"
Dim strSQL As String = "SELECT Content from Docs where LeafName ='" &
Documentnaam & "'"
Dim cnnDatabase As New SqlConnection(connectionString)
Dim myCommand As SqlCommand = New SqlCommand(strSQL, cnnDatabase)
Try
myCommand.CommandTimeout = 500
cnnDatabase.Open()
Dim dreader As SqlDataReader = myCommand.ExecuteReader()
If (dreader.Read()) Then
Response.ContentType = "application/pdf"
Response.BinaryWrite(dreader("Content"))
End If
Catch ex As Exception
Me.Label1.Text = ex.ToString
Finally
cnnDatabase.Close()
End Try