473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Handling a date in a datetime format

102 64KB
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)
  2.  
How do I pullout the just the date?
Sep 23 '15 #1
1 1193
You would need to surround the date/time with the # sign rather than the '.
Example: AND DateSignIn=#" & yourDate & "#", myConnection)
Sep 30 '15 #2

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

Similar topics

1
by: seash | last post by:
H when i execute this query, my query is crashing throwing an exception "cant convert char datatype to datetime type format my query is "insert into mytable(mydate) values ('"+ varmydate+ "')...
1
by: mimi | last post by:
my database has separate field for date and time so we can capture employees' time in and out . In Sql, date can be present in smalldatetime format, which contains only time hh:mm:ss AM/PM. How...
2
by: Harikumar G | last post by:
Friends, My hardware sends me a date format like this 15:10:20.99 UTC Mon Oct 18 2004 I need to process this format and parse to a valid SQL datetime format, how can I do it more easily? My...
1
by: Esref Durna | last post by:
my sql server have this datetime format ( yyyy-mm-dd ) how could i change it to dd.mm.yyyy format or what should i do? thanks
10
by: okaminer | last post by:
Hi I have a program which need to get the date in the format of dd/MM/yyyy (example 24/7/2005) but when I use DateTime.Now().ToShortDatetime() the date come back as MM/dd/yyyy (example...
1
by: Ugur Ekinci | last post by:
Hi , I have two Sql Server 2000 on seperate machines , First one accepts datetime format like ("dd.MM.yyyy hh:mm:ss") And Second one accepts datetime format like ("MM.dd.yyyy hh:mm:ss") 1-...
2
by: bhv | last post by:
hello everybody, i have datetime format in mysql database table. now, in mysql date is YYYY-MM-DD format. how can i insert date in this format with VB Script ? i had tried following dim dt, dy,...
9
by: Alok yadav | last post by:
i am using a webservice in which a method is serach. i use this method which accept a argument of date type in dd/MM/yyyy formate. i have a textbox which accept the date from the user, when i...
4
by: Curious | last post by:
Hi, I have a column in a grid defined as DateTime type. Currently, it's displayed in the format of "5/23/2007", for an example. It seems that it's using the default "short date" format. I...
2
by: Seth Williams | last post by:
I need to fill a textbox with a date that, based on the current day, is 2 months back - PLUS I need it to reflect the first day of the month so - I've got : Dim dNow As DateTime =...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.