OdbcFreeStmt hStmt,0
OdbcExecDirect hStmt, "SELECT TOP 1 * FROM music WHERE filename LIKE '%" & texttosql(file_pathsplit(bestand,%Path_RootPathProg)) & "%' AND extension LIKE '%" & texttosql(file_pathsplit(bestand,%Path_ext)) & "%'"
odbcsetabsoluteposition hstmt,1
szArtist = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,2)) :cbArtist = LEN(szArtist)
szTitle = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,3)):cbTitle = LEN(szTitle)
szDuration = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,4)):cbDuration = LEN(szDuration)
szGenres = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,5)):cbGenres = LEN(szGenres)
szYear = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,6)):cbYear = LEN(szYear)
szRating = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,7)):cbRating = LEN(szRating)
szTempo = texttosql(ListView_GetItemText(tabdatabase, %listview1,irec,8)):cbTempo = LEN(szTempo)
szBitrate = texttosql(Bitrate):cbBitrate = LEN(szBitrate)
szRelease = texttosql(release):cbRelease = LEN(szRelease)
szLastPlayed = "0":cbLastPlayed = LEN(szLastPlayed)
szTimesPlayed = "0":cbTimesPlayed = LEN(szTimesPlayed)
szInstrDub = instrdub:cbInstrDub = LEN(szInstrDub)
szAcappella = acappella:cbAcappella = LEN(szAcappella)
szMegamix = megamix:cbMegamix = LEN(szMegamix)
szRemix = remix:cbRemix = LEN(szRemix)
szChristmas = christmas:cbChristmas = LEN(szChristmas)
szAnalyzed = "y":cbAnalyzed = LEN(szAnalyzed)
OdbcUpdateRecord hStmt
OdbcFreeStmt hStmt,0
OdbcExecDirect hStmt, "SELECT * FROM music ORDER BY SID"
function texttosql(txt as string) as string 'replace forbidden characters in sql string
txt=replace$(txt,"'",$dq)
txt=replace$(txt,"\","|")
txt=replace$(txt,"[","<")
txt=replace$(txt,"]",">")
function=txt
end function
function sqltotext(txt as string) as string
txt=replace$(txt,$dq,"'")
txt=replace$(txt,"|","\")
txt=replace$(txt,"<","[")
txt=replace$(txt,">","]")
function=txt
end function
ThinBasic always seems to crash somewhere else as soon this code has been executed multiple times.
Bookmarks