records deleted from database when uploading files

When i try to upload multiple pictures to the database my code works fine and all the pictures show in the gallery, but when i try to modify the picture in the database, and modify one picture it deletes the rest of the pictures from the database. The recordset isnt deleted and the rest of the information stays the same, its just the 5+ places i have for the pictures whose data gets deleted. here is my code so far..

message.Text = "please wait"
    pics.Visible = False
    'wherepics are stored
    Dim savepath As String = Server.MapPath("/cgi-bin/properties/")
    Dim tfn0 As String = ""
    Dim tfn1 As String = ""
    'dims the filenames a variables
    Dim img0 As String = pic0.FileName
    Dim img1 As String = pic1.FileName
    'this is the set of paths to check
    'this will check for redundencies in the database so no dublicate file names will occur
    Dim ptc0 As String = savepath + img0
    Dim ptc1 As String = savepath + img1

    Dim url0 As String = ""
    Dim url1 As String = ""
    Dim counter As Integer = 2
    If (System.IO.File.Exists(ptc0)) Then
        While (System.IO.File.Exists(ptc0))
            tfn0 = counter.ToString = img0
            ptc0 = savepath + tfn0
            counter = counter + 1
        End While
    ElseIf (System.IO.File.Exists(ptc1)) Then
        While (System.IO.File.Exists(ptc1))
            tfn1 = counter.ToString = img1
            ptc1 = savepath + tfn1
            counter = counter + 1
        End While
    End If
    Dim sp0 As String = savepath + img0
    Dim sp1 As String = savepath + img1
    If Not pic0.FileName = Nothing Then
        pic0.SaveAs(sp0)
        img0 = pic0.FileName
        url0 += "pic_main"
        url1 += img0
    End If
    If Not pic1.FileName = Nothing Then
        If pic0.FileName = Nothing Then
            pic1.SaveAs(sp1)
            img1 = pic0.FileName
            url0 += "pic_one"
            url1 += img1
        Else
            pic1.SaveAs(sp1)
            img1 = pic0.FileName
            url0 += ", pic_one"
            url1 += ", " & img1
        End If

    End If

    Dim datanames() As String = {url0}
    ', "pic_six", "pic_seven", "pic_eight", "pic_nine"
    Dim datavalues() As String = {url1}
    ', file6, file7, file8, file9
    DB.UpdateCommand(datanames, datavalues, "property", "property_id = " & Request.QueryString("id")) ', true)
    Response.Redirect("finished.aspx")

Answers


I have found the solution it was looking at all of the file upload controls, since nothing was in them it would reference those fields I had this figured out a while ago, got busy and never found time to post my answer. in the database and delete anything that was in it and replace it with a blank space. I changed the code a bit to where the users chooses the slot in which they want to update, then carry over a qstring instead of having it update all of them at once


Need Your Help

Location of STDOUT storage in Java application running as a Windows Service

java windows heap stdout

I have a Java application that is run as a background process to a Windows Service application.

Trouble with functions in python 2.7.3

python function python-2.7

I am new to learning python, and I only have limited programing experience, so I am sorry for asking such a basic question. I am doing an online python tutorial and wanted to take the program a bit

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.