SELECT c.[LocationID] ,c.[FileName] ,c.[SaveType] ,l.[ArchiveFolderName] ,l.[DBFolderName] ,l.[CardNum] ,l.[ChannelNum] ,r.[ServerName] FROM [TelsaCo].[dbo].[OfflineCallInfo] c inner join [TelsaCo].[dbo].[OfflineLocation] l on c.LocationID = l.LocationID inner join [TelsaCo] .[dbo].[OfflineRecordServers] r on c.RecordServerID = r.ServerID WHERE CallID = 'xxxxxxxx' strFilePath = ds.Tables(0).Rows(0)("DBFolderName").ToString() strFilePath = strFilePath & ds.Tables(0).Rows(0)("ArchiveFolderName").ToString() & "\" strFilePath = strFilePath & ds.Tables(0).Rows(0)("ServerName").ToString() & "\" strFilePath = strFilePath & "card" & ds.Tables(0).Rows(0)("CardNum").ToString() & "channel" & ds.Tables(0).Rows(0)("ChannelNum").ToString() & "\" strFilePath = strFilePath & ds.Tables(0).Rows(0)("FileName").ToString() If ds.Tables(0).Rows(0)("SaveType").ToString() = "2" Then strFilePath = strFilePath & ".wav" ElseIf ds.Tables(0).Rows(0)("SaveType").ToString() = "6" Then strFilePath = strFilePath & ".mp3" End If