Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Try Dim strQuery As String = "select FName,LName,[Add],City,Image,Adddate from prakashkaur.dbo.PersonDetail " Dim cmd As SqlCommand = New SqlCommand(strQuery) Dim dt As New DataTable Dim adap As New SqlDataAdapter cmd.CommandType = CommandType.Text cmd.Connection = myConnection adap.SelectCommand = cmd adap.Fill(dt) Dim strQuery2 As String = "select FName,LName,[Add],City,Image,Adddate from prakashkaur.dbo.PersonDetail where 1=2" Dim cmd2 As SqlCommand = New SqlCommand(strQuery2) Dim dt2 As New DataTable cmd2.CommandType = CommandType.Text cmd2.Connection = myConnection adap.SelectCommand = cmd2 adap.Fill(dt2) GridView1.DataSource = dt2 If dt IsNot Nothing Then Dim inti As Integer For inti = 0 To dt.Rows.Count - 1 Dim bytes() As Byte = CType(dt.Rows(inti)("Image"), Byte()) Response.Buffer = True Response.Charset = "" Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.BinaryWrite(bytes) dt2.ImportRow(dt.Rows(inti)) Next End If Catch ex As Exception MsgBox(ex.Message) End Try End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)