Problem in Retrieving images from sql server 2000 to ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • davidson1
    New Member
    • Feb 2008
    • 144

    Problem in Retrieving images from sql server 2000 to ASP.NET

    Hai,

    I have no problem of inserting images to sql server 2000 from ASP.NET , but while retreiving it retrieves one image only, but i have 3 images in the table , i have the used the following code , if any mistake pl reply me

    i have table image1 with field imgid,img

    Code:-

    Dim cn As New SqlClient.SqlCo nnection

    cn.ConnectionSt ring = "Persist Security Info=False;User ID=sa;Initial Catalog=master; password=david; "

    cn.Open()

    Dim myCommand As New SqlCommand("Sel ect * from image1", cn)

    Try

    Dim myDataReader As SqlDataReader

    myDataReader = myCommand.Execu teReader(Comman dBehavior.Close Connection)

    While (myDataReader.R ead())

    Response.Binary Write(myDataRea der.Item("img") )

    End While

    cn.Close()

    Response.Write( "Person info successfully retrieved!")

    Catch SQLexc As SqlException

    Response.Write( "Read Failed : " & SQLexc.ToString ())

    End Try

    Next



    pl reply me i need for my project........ ............... .........

    Posted Date:- 11 Feb 2008

    Davidson
  • peerraghu
    New Member
    • Nov 2007
    • 30

    #2
    hi just check this link which very simple
    http://aspalliance.com/141

    Comment

    Working...