By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.

Handling a date in a datetime format

P: 102
Background: Front End–Visual Studio/Visual Basic 2013: Back End – SQL Server 2014

I have a vb program that needs to read from a table all entries where the date is a specific value. The table entry has a field that is defined as datetime field. An example of SQL table:

ID_SignInOut int
ID_Visitor int
DateSignIn datetime

My code (partially complete)-

Expand|Select|Wrap|Line Numbers
  1. myCommand = New SqlCommand("Select * from [200-SignInOut] where  ID_Visitor=" &  ID_Visitor & " AND DateSignIn="'" & "???'" , myConnection)
How do I pullout the just the date?
Sep 23 '15 #1
Share this Question
Share on Google+
1 Reply

P: 24
You would need to surround the date/time with the # sign rather than the '.
Example: AND DateSignIn=#" & yourDate & "#", myConnection)
Sep 30 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.