這篇文章是我寫的
和存儲圖片相比
1.如何設置圖片的格式?
2.如何使用BinaryWrite方法
我們已經在Person表中存儲了數據
從sqlserver中讀取圖片的代碼
Public Sub Page_Load(sender As Object
Dim myConnection As New SqlConnection(ConfigurationSettings
Dim myCommand As New SqlCommand(
Try
myConnection
Dim myDataReader as SqlDataReader
myDataReader = myCommand
Do While (myDataReader
Response
Response
Loop
myConnection
Response
Catch SQLexc As SqlException
Response
End Try
End Sub
二
上面的例子很簡單
源代碼
/// retriving
<%@ Page Language=
<%@ Import Namespace=
<%@ Import Namespace=
<HTML>
<HEAD>
<title>Retrieving Image from the SQL Server</title>
<script runat=server>
Public Sub Page_Load(sender As Object
Dim myConnection As New SqlConnection(ConfigurationSettings
Dim myCommand As New SqlCommand(
Try
myConnection
Dim myDataReader as SqlDataReader
myDataReader = myCommand
Do While (myDataReader
Response
Response
Loop
myConnection
Response
Catch SQLexc As SqlException
Response
End Try
End Sub
</script>
</HEAD>
<body style=
</body>
</HTML>
From:http://tw.wingwit.com/Article/program/net/201311/15185.html