I'm working in vb.net. I'm trying to create a query for a table adapter that will filter data. The query is
The table lies in a SQL Server and the LoginDate's type is DATETIME.
Right now, the query is returning nothing. I'm fairly certain the problem lies in the DATETIME format surrounding the LoginDate. The parameter @LoginDate starts out as a string, and I've tried converting it to datetime with CONVERT(DATETIM E, @LoginDate, 102) and CONVERT(DATETIM E, @LoginDate). I've also tried other formats beside 102, but nothing seems to work.
How can I get LoginDate and @LoginDate into the same format? The format must contain the date and the time (including seconds).
Thanks in advance.
Code:
SELECT CommitteeId, CommitteePostion FROM MemberIndexApp WHERE ((UserName = @UserName) AND (LoginDate = @LoginDate))
Right now, the query is returning nothing. I'm fairly certain the problem lies in the DATETIME format surrounding the LoginDate. The parameter @LoginDate starts out as a string, and I've tried converting it to datetime with CONVERT(DATETIM E, @LoginDate, 102) and CONVERT(DATETIM E, @LoginDate). I've also tried other formats beside 102, but nothing seems to work.
How can I get LoginDate and @LoginDate into the same format? The format must contain the date and the time (including seconds).
Thanks in advance.
Comment