I want only two records to be in my table (database), new record should overwrite the previous records on basis on ImgID .
WHERE ImgID=1
i am using this code:
Dim conn As New SqlConnection
conn.ConnectionString = ConfigurationManager.ConnectionStrings("DispImages ConnectionString").ConnectionString
Dim cmd As New SqlCommand
cmd.CommandText = "INSERT INTO ImgTable (PicURL) VALUES (@PicURL)"
cmd.Parameters.Add("@PicURL", SqlDbType.VarChar)
cmd.Parameters("@PicURL").Value = FileUpload1.FileName
cmd.Connection = conn
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Label1.ForeColor = Drawing.Color.Green
Label1.Text = "<b>File Uploaded Successfully</b>" & "<br>" & "File name: " & _
FileUpload1.FileName
-----------------------
I tried this code, but won't work...
cmd.CommandText = "INSERT INTO ImgTable (PicURL) VALUES (@PicURL) WHERE ImgID=1"
Bookmarks