 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Storing images in SQL Server 2005 and retrieving them from VB.NET</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/</link>
	<description></description>
	<lastBuildDate>Sun, 26 May 2013 01:40:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: bfullen</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/#comment-107514</link>
		<dc:creator>bfullen</dc:creator>
		<pubDate>Tue, 15 May 2012 15:43:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-107514</guid>
		<description><![CDATA[He said VB.NET.  I am so tired of people asking for VB.NET solutions and people posting a C# solution.  There is a reason we are asking for a VB.NET solution!!!]]></description>
		<content:encoded><![CDATA[<p>He said VB.NET.  I am so tired of people asking for VB.NET solutions and people posting a C# solution.  There is a reason we are asking for a VB.NET solution!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: palanivelkavi</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/#comment-87934</link>
		<dc:creator>palanivelkavi</dc:creator>
		<pubDate>Fri, 11 Feb 2011 12:54:28 +0000</pubDate>
		<guid isPermaLink="false">#comment-87934</guid>
		<description><![CDATA[Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) 

        Image1.ImageUrl = &quot;~/ShowImage.ashx?id=&quot; &amp; ID

    End Sub
End Class]]></description>
		<content:encoded><![CDATA[<p>Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) </p>
<p>        Image1.ImageUrl = &#8220;~/ShowImage.ashx?id=&#8221; &amp; ID</p>
<p>    End Sub<br />
End Class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: palanivelkavi</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/#comment-87933</link>
		<dc:creator>palanivelkavi</dc:creator>
		<pubDate>Fri, 11 Feb 2011 12:52:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-87933</guid>
		<description><![CDATA[----------CODE FRO--------.ASHX-----------------------
Imports System
Imports System.Configuration
Imports System.Web
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient

Public Class ShowImage
    Implements IHttpHandler
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
        Dim empno As Int32
        If Not context.Request.QueryString(&quot;id&quot;) Is Nothing Then
            empno = Convert.ToInt32(context.Request.QueryString(&quot;id&quot;))
        Else
            Throw New ArgumentException(&quot;No parameter specified&quot;)
        End If

        context.Response.ContentType = &quot;image/jpeg&quot;
        Dim strm As Stream = ShowEmpImage(empno)
        Dim buffer As Byte() = New Byte(4095) {}
        Dim byteSeq As Integer = strm.Read(buffer, 0, 4096)

        Do While byteSeq &gt; 0
            context.Response.OutputStream.Write(buffer, 0, byteSeq)
            byteSeq = strm.Read(buffer, 0, 4096)
        Loop
        &#039;context.Response.BinaryWrite(buffer);
    End Sub

    Public Function ShowEmpImage(ByVal empno As Integer) As Stream
        Dim conn As String = ConfigurationManager.ConnectionStrings(&quot;EmployeeConnString&quot;).ConnectionString
        Dim connection As SqlConnection = New SqlConnection(conn)
        Dim sql As String = &quot;SELECT empimg FROM image WHERE empid = @ID&quot;
        Dim cmd As SqlCommand = New SqlCommand(sql, connection)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue(&quot;@ID&quot;, empno)
        connection.Open()
        Dim img As Object = cmd.ExecuteScalar()
        Try
            Return New MemoryStream(CType(img, Byte()))
        Catch
            Return Nothing
        Finally
            connection.Close()
        End Try
    End Function

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
        Get
            Return False
        End Get
    End Property


End Class]]></description>
		<content:encoded><![CDATA[<p>&#8212;&#8212;&#8212;-CODE FRO&#8212;&#8212;&#8211;.ASHX&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Imports System<br />
Imports System.Configuration<br />
Imports System.Web<br />
Imports System.IO<br />
Imports System.Data<br />
Imports System.Data.SqlClient</p>
<p>Public Class ShowImage<br />
    Implements IHttpHandler<br />
    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest<br />
        Dim empno As Int32<br />
        If Not context.Request.QueryString(&#8220;id&#8221;) Is Nothing Then<br />
            empno = Convert.ToInt32(context.Request.QueryString(&#8220;id&#8221;))<br />
        Else<br />
            Throw New ArgumentException(&#8220;No parameter specified&#8221;)<br />
        End If</p>
<p>        context.Response.ContentType = &#8220;image/jpeg&#8221;<br />
        Dim strm As Stream = ShowEmpImage(empno)<br />
        Dim buffer As Byte() = New Byte(4095) {}<br />
        Dim byteSeq As Integer = strm.Read(buffer, 0, 4096)</p>
<p>        Do While byteSeq &gt; 0<br />
            context.Response.OutputStream.Write(buffer, 0, byteSeq)<br />
            byteSeq = strm.Read(buffer, 0, 4096)<br />
        Loop<br />
        &#8216;context.Response.BinaryWrite(buffer);<br />
    End Sub</p>
<p>    Public Function ShowEmpImage(ByVal empno As Integer) As Stream<br />
        Dim conn As String = ConfigurationManager.ConnectionStrings(&#8220;EmployeeConnString&#8221;).ConnectionString<br />
        Dim connection As SqlConnection = New SqlConnection(conn)<br />
        Dim sql As String = &#8220;SELECT empimg FROM image WHERE empid = @ID&#8221;<br />
        Dim cmd As SqlCommand = New SqlCommand(sql, connection)<br />
        cmd.CommandType = CommandType.Text<br />
        cmd.Parameters.AddWithValue(&#8220;@ID&#8221;, empno)<br />
        connection.Open()<br />
        Dim img As Object = cmd.ExecuteScalar()<br />
        Try<br />
            Return New MemoryStream(CType(img, Byte()))<br />
        Catch<br />
            Return Nothing<br />
        Finally<br />
            connection.Close()<br />
        End Try<br />
    End Function</p>
<p>    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable<br />
        Get<br />
            Return False<br />
        End Get<br />
    End Property</p>
<p>End Class</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: palanivelkavi</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/#comment-87932</link>
		<dc:creator>palanivelkavi</dc:creator>
		<pubDate>Fri, 11 Feb 2011 12:47:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-87932</guid>
		<description><![CDATA[i have following type of table

r1:id,r2:name,r3:image following up 5 person detais in SQL 

I need asp Coding for when i entered name want to show that person Image.]]></description>
		<content:encoded><![CDATA[<p>i have following type of table</p>
<p>r1:id,r2:name,r3:image following up 5 person detais in SQL </p>
<p>I need asp Coding for when i entered name want to show that person Image.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chejane</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/storing-images-in-sql-server-2005-and-retrieving-them-from-vbnet/#comment-76642</link>
		<dc:creator>chejane</dc:creator>
		<pubDate>Fri, 30 Apr 2010 03:05:13 +0000</pubDate>
		<guid isPermaLink="false">#comment-76642</guid>
		<description><![CDATA[hi! can somebody help me about my problem?
I want to retrieve the picture from sql server database and display it on a website using VB.net. coz&#039; my boss want to display the student pictures, infos. and grades of the students. now he want me to retrieve the pictures of the students from sql database and display it on our website. pls help me do this project. i have a table in my database
student id (nchar8)
student name (nchar30)
Student Photo (varbinary(max))

help me to encode the VB to business intelligence development studio pls?]]></description>
		<content:encoded><![CDATA[<p>hi! can somebody help me about my problem?<br />
I want to retrieve the picture from sql server database and display it on a website using VB.net. coz&#8217; my boss want to display the student pictures, infos. and grades of the students. now he want me to retrieve the pictures of the students from sql database and display it on our website. pls help me do this project. i have a table in my database<br />
student id (nchar8)<br />
student name (nchar30)<br />
Student Photo (varbinary(max))</p>
<p>help me to encode the VB to business intelligence development studio pls?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 3/10 queries in 0.035 seconds using memcached
Object Caching 323/329 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-26 08:06:40 -->