473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Delete duplicate file path from database if i include i wnt child node to delete

Expand|Select|Wrap|Line Numbers
  1. Public Sub RemoveBSDuplicateentry()
  2.      Dim strSQL As String
  3.      Dim lngCnt As Long
  4.      Dim rs As Recordset
  5.      Dim rs1 As Recordset
  6.      Dim uSQryAcss As String
  7.      Dim uSQrySql As String
  8.      Dim objDB As New RBDBModule.DBModule
  9.      Dim fname As String
  10.      Dim ftype As String
  11.      Dim status As Integer
  12.      Dim strSQL1 As String
  13.      Dim strSQL2  As String
  14.      Dim Count As Integer
  15.      Dim fpath As String
  16.  
  17.      glngProcessSetID = glngDisplaySetID
  18.      strSQL = "SELECT * FROM Backupset WHERE [SetNameid]=" & glngProcessSetID & ""
  19.  
  20.  
  21.              If gintDbType = 0 Then
  22.                 Set rs = db.OpenRecordset(strSQL)
  23.              ElseIf gintDbType = 1 Then
  24.                 Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
  25.              End If
  26.  
  27.             Do Until rs.EOF
  28.                 status = rs("status")
  29.                 ftype = rs("Type")
  30.                 fname = rs("filename")
  31.                 fpath = rs("filepath") & "\" & fname
  32.                 If status = 2 Then
  33.                     If ftype = 2 Then
  34.                         If gintDbType = 0 Then
  35.                            strSQL1 = "SELECT * FROM Backupset WHERE [SetNameid]=" & glngProcessSetID & " AND Filepath Like '*" & fpath & "*'"
  36.                            Set rs1 = db.OpenRecordset(strSQL1)
  37.                         ElseIf gintDbType = 1 Then
  38.                                strSQL2 = "SELECT * FROM Backupset WHERE [SetNameid]=" & glngProcessSetID & " AND Filepath Like '%" & fpath & "%'"
  39.                                Set rs1 = db.OpenRecordset(strSQL2, dbOpenDynaset, dbSeeChanges)
  40.                         End If
  41.                         Count = rs1.RecordCount
  42.                         'If Count > 0 Then
  43.                             Do Until rs1.EOF
  44.                                 If gintDbType = 0 Then
  45.                                    uSQryAcss = "DELETE FROM [Backupset] WHERE [SetNameid]=" & glngProcessSetID & " AND [FilePath] Like '*" & fpath & "*' "
  46.                                    db.Execute uSQryAcss
  47.                                 ElseIf gintDbType = 1 Then
  48.                                        uSQrySql = "DELETE FROM [Backupset] WHERE [SetNameid]=" & glngProcessSetID & " AND [FilePath] Like '%" & fpath & "%' "
  49.                                        Set objDB = New RBDBModule.DBModule
  50.                                        lngCnt = objDB.UpdateRecordstoDB(uSQrySql, gsDbDatabase, gsDbServer, gsDbUser, gsDbPass)
  51.                                 End If
  52.                             rs1.MoveNext
  53.                             Loop
  54.                         'End If
  55.                     End If
  56.                 End If
  57.             rs.MoveNext
  58.             Loop
  59.             rs.Close
  60.  
  61. proc_exit:
  62.         On Error Resume Next
  63.             Set rs = Nothing
  64.         Exit Sub
  65. proc_error:
  66.  
  67. clog.WriteLog "Error in:RemovebsDuplicateEntry()............"
  68. GoTo proc_exit:
  69. End Sub
  70.  
Attached Images
File Type: jpg xxx.jpg (67.1 KB, 86 views)
Feb 3 '16 #1
0 1037

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Barbara | last post by:
Hi, I have an sql database that has the primary key set to three fields, but has not been set as unique(I didn't create the table). I have 1 record that has 2 duplicates and I am unable to delete...
2
by: Simon | last post by:
I wonder if someone can help with this - I 'm creating an IISVirtualDirectory, and setting its Path property to the physical path I want to reference. This works fine when I have a standard file...
23
by: da Vinci | last post by:
Greetings, Onwards with the school studying. Working on a program and need to delete a file from a known location on the hard drive but cannot get anything I do to work. I have tried to use...
5
by: Patient Guy | last post by:
In my reading of the Strict and Transitional DTD for HTML 4.0, the table row (TR) elements are contained within table section elements: THEAD, TFOOT, and TBODY. The table section elements are...
3
by: VK | last post by:
On Windows platforms path separator "\" collides with the script escape sign "\" Obvious and old way to prevent it is to double backslashes: "\\" But I'm curious if there is a reliable way to...
2
by: createdbyx | last post by:
I am trying to make a file sync utillity to sync files between my laptop and my desktop pc. On my desktop machine (xp pro sp2) I have shared my "Visual Studio Projects" folder using windows simple...
7
by: marce1972 | last post by:
Hi to all, that's my question I have mysql database and a web page to upload files to my webpage, I know how to delete them from the database, but didnt find the code to delete them from the web...
6
by: Mohammad Omer | last post by:
Hi, I tried to validate file path without calling file creating functions. Is it possible? How? Regards, -aims
1
by: Zuhaib Hyder | last post by:
how to delete client file using c# or javascript ? file delete prmissions are already given?
20
omerbutt
by: omerbutt | last post by:
hi there i am making an application in which i have to populate columns that consist of some textfields and some input boxes the problem is at the mozilla's end, it creates a new node and appends the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.