Auto Perging data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Zerin
    New Member
    • Dec 2006
    • 56

    #1

    Auto Perging data

    To all,

    Best regards.I submitted this problem about auto purge a database many days ago but there's no reply till now.If anyone has any solution,please reply as soon as possible.

    Is aouto purging possible in Visual Basic 2005 Express? How can I do it or get related codes?

    Your help will be greatly honoured.

    Zerin
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by Zerin
    Best regards.I submitted this problem about auto purge a database many days ago but there's no reply till now.If anyone has any solution,please reply as soon as possible.

    Is aouto purging possible in Visual Basic 2005 Express? How can I do it or get related codes?
    Um... can you please explain what you mean by "auto-perging"? (By the way, in English at least, it's more likely to be "purging" than "perging".

    Comment

    • Zerin
      New Member
      • Dec 2006
      • 56

      #3
      Originally posted by Killer42
      Um... can you please explain what you mean by "auto-perging"? (By the way, in English at least, it's more likely to be "purging" than "perging".
      Killer42 my frnd !

      I solved the problem on the front-end by VB 2005.I'm pasting the code sample here:

      [PHP]Private Sub autoParge(ByVal oledbConn As OleDbConnection )
      strSQL = " DELETE * FROM INSPECTION WHERE INT(Datediff('d ',DATE,now()))> 30 "
      sqlCommand = New OleDbCommand(st rSQL, oledbConn)
      Try
      oledbConn.Open( )
      sqlCommand.Exec uteNonQuery()
      Catch ex As Exception
      MsgBox(ex.Messa ge)
      Finally
      oledbConn.Close ()
      End Try

      End Sub[/PHP]

      Here, INSPECTION is a table of data,DATE is the time inserted in one column of the table (related to the data appearance in the table) and this module has to be called from where it should be.

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Hey, good to see you got it sorted out.

        However, I'm sure you know by now that I hate to let anything go by without commenting. :) So, I do have a couple of questions/comments:
        • Is the Int( ) function necessary in the SQL string? I thought that DateDiff would already return an int. (I'm not telling you - just asking, as I'm too lazy to check).
        • I think that by using DATE as a field name you are setting yourself up for potential problems in the future. Because in MS Access the DATE (or DATE( )) function is the equivalent of VB's Now( ).
        • I just love the colour-coding produced by the PHP tags. I'm starting to think maybe I should use PHP instead of CODE to tag my code on TheScripts.

        Comment

        • Zerin
          New Member
          • Dec 2006
          • 56

          #5
          Originally posted by Killer42
          Hey, good to see you got it sorted out.

          However, I'm sure you know by now that I hate to let anything go by without commenting. :) So, I do have a couple of questions/comments:
          • Is the Int( ) function necessary in the SQL string? I thought that DateDiff would already return an int. (I'm not telling you - just asking, as I'm too lazy to check).
          • I think that by using DATE as a field name you are setting yourself up for potential problems in the future. Because in MS Access the DATE (or DATE( )) function is the equivalent of VB's Now( ).
          • I just love the colour-coding produced by the PHP tags. I'm starting to think maybe I should use PHP instead of CODE to tag my code on TheScripts.

          Well,
          • As I'm new in VB,when the result of the line with DataDiff didn't work properly, I tried INT and then it worked out.So, I don't know........... ......actually.
          • And thanks for letting me know about the DATE() function.I don't want myself to be screwed up in future......... ...so,I think I'll change it.
          • I just used the PHP tech today and it looks really nice.


          Hey,can you prescribe me any tutorial that will help me developing myself faster in VB 2005 (with Access) ?

          Actually I had been a Database guy,so in VB I seem to be lost myself.Please help.

          Comment

          Working...