Click here to Skip to main content
13,095,218 members (78,607 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i have created an small application which edit image, i want to store it and retrieve from database, i have an online database, every thing is working fine but uploading and retrieval of image is too slow , how can i make it work fast.
connection code
            Dim gszStr As String

            gszStr = "Data Source =server ip;database=dbName ;UID=@# ;Password=$#$#$"
            Con.ConnectionString = gszStr
        Catch ex As Exception
            MsgBox("Not Connected To Internet", MsgBoxStyle.Information)
        End Try
    End Sub

Retrieval Code
            Dim ct1 As New SqlClient.SqlCommandBuilder
            Dim tmpds As New DataSet
            Dim tmpda As New SqlDataAdapter
            tmpda.SelectCommand = New SqlCommand(sql, Con)
            If tmpds.Tables(0).Rows.Count <> 0 Then

            End If
        Catch ex As Exception
            MsgBox("Server Not Responding", MsgBoxStyle.Critical)
        End Try

Upload code
  Dim Sqlstr As String
        Dim daH As New SqlDataAdapter
        Dim data() As Byte = PF_SaveImage()
        PictureBox1.Image.Save("C:\NewFileName.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
        Sqlstr = ("Insert into TestImage Values(@Img)")              ''
        daH.InsertCommand = New SqlCommand(Sqlstr, Con)
        daH.InsertCommand.Parameters.Add(New SqlParameter("@Img", SqlDbType.Image)).Value = data
        '******************Give save successfull message ***********************
        MsgBox("Values Saved Successfully", MsgBoxStyle.Information)

code is working fine but how to speed up things ?
Posted 10-May-13 20:54pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

No, probably not.
The problem is almost certainly the amount of traffic between you and the server via the internet - which is restricted by you connection speed. If this operation is slow, it is likely that your connection speed is just not up to the job, particularly upload which is generally slower than download anyway. Depending on the connection speed and the size of your images, it could take some considerable time to view the images (try looking at large images from the net - they take time to appear for exactly the same reasons)

Using an "open" database on the internet directly is a fairly poor idea from a security point of view anyway, so live with the delay, or find a more local cache from your images. And I really, really hope you have disabled the "SA" account on your SQL server!
akjan4 11-May-13 8:29am
for the same reason above , I decide to save all data to my local database(ms Access) then export it to SQLServer, now i need to know, how to do it.
OriginalGriff 11-May-13 8:43am
What part is a problem?
akjan4 12-May-13 7:19am
i crated a local access database, where i store every information,this local database is same as my online Database,now what i have done so far is that, im copying Access data to online database using sqlbulkcopy, work fine on normal data, but during copying image files from access to online database it work too slow, i declared the batch size to 10, still taking too much time to write image on online Database, what to do ??? please help me out

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 11 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100