SQL statement for 'Last Played' date?

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Posts: 48
Joined: Sun Oct 08, 2006 12:43 pm

SQL statement for 'Last Played' date?

Post by monitoringpost »

I'm attempting to modify a script that's suppose to insert the "Last Played" date using the following SQL statement:

Code: Select all

strDummyDate = Now
strSQL = "INSERT into Played (IdSong, PlayDate) values (" & itm.ID & ",'" & strDummyDate & "')"
Unfortunately, strDummyDate isn't being inserted. The format of the date that I'm importing will be 2008-10-19 06:00:00. I thought I'd simply find an example or two from existing scripts but the ones I've tried aren't working and I'm not sure if it's because the SQL statement is wrong or that the date is formatted wrong. Could someone perhaps advise me on my SQL statement and if the format of the date needs changing.

I'm writing this for MM2 even though my sig shows MM3.


Roku M1001 v3.0.52 beta | R1000 v3.0.52 beta
XBMC vPre2.1 SVN rev13360
NAS: Maxtor SS+ v2.6.2-openmss1-rc2
Linux Server: Firefly svn-1586-1 mipsel pkg
Router: Linksys WRT54GS
MediaMonkey v3.2.5.1306 | iRock Remote on iPhone
... and one kick ass rig!

Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: SQL statement for 'Last Played' date?

Post by Bex »

This should work: (Not tested)

Code: Select all

DummyDate = Cdbl(Now)
DummyDate = Replace(DummyDate,",",".") 'Many locales uses comma as decimal separator
strSQL = "INSERT INTO Played (IdSong, PlayDate) values (" & itm.ID & "," & DummyDate & ")"
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
Post Reply