select A.tid, A.name, B.class, B.seat from traindetail as A inner join class as B on A.tid=B.tid where A.source = 'SourceFromUser' and A.destination = 'DestinationFromUser' and A.date=convert(datetime,'DateFromUser',103) and B.class='classFromUser'
execute this query and check the row count. if the rowcount is > 0 then display conformation otherwise display appropriate error message.
hope this helps..