Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Query Syntax

Posted on 2011-03-18
8
Medium Priority
?
417 Views
Last Modified: 2012-05-11
okay someone wake me up here

I am making a simple query  VB.NET access DB  

SELECT ID, LN, FN,  Date_active FROM Clients
WHERE Date_active >=   ?
ORDER BY  LN


in my VB code i am biding it to a datetimepicker

 Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
       
Dim Date_active As Date = DateTimePicker1.Value

        MembersTableAdapter.Fill(DsDataset.Clients, _
                                 Date_Active)
End Sub

When I run it its showing all the records   > ?          but NOT records  = ?  

much appreciated easy 2000 pts  

0
Comment
Question by:plusone3055
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 18

Accepted Solution

by:
Jerry Miller earned 2000 total points
ID: 35169857
Are you sure that you have equal records? I mean down to the seconds? You could be comparing March 18, 2011 10:00:00 to March 18, 2011 10:00:01 and all you are seeing is March 18, 2011.
0
 
LVL 22

Author Comment

by:plusone3055
ID: 35169883
no the dates in the table are like 2/14/2011 not time
so I put  2/14/2011  in my datetimepicker (which is set to short)
and as stated before it display all records  > 2/14/2011   but not = 2/14/2011  

0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35169903
i suggest you to put a format to the date in your sql statement
different database handles date format differently.

for Sql Server it will look like this:
SELECT ID, LN, FN,  Date_active FROM Clients where Convert(varchar,Date_Active,103) >= ?

'103' is DD/MM/YYYY format, you can use other date formatting that you desired.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Author Comment

by:plusone3055
ID: 35169924
figured it out time format was wrong in the database
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35169933
its the default date format that the database handles which you can change the default date setting based on what database you are using. another solution is to set a date format in your sql query as I suggested.
0
 
LVL 22

Author Comment

by:plusone3055
ID: 35169957
sorry i thought i could reopen to give out poitns and its giving me **** about that really sorry ive never had a problem aewarding points to anyone :(
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35170083
i think my suggestion works for the author problems.
0
 
LVL 41

Expert Comment

by:Sharath
ID: 35174101
try DATEVALUE to truncate the time part.
SELECT ID, LN, FN,  Date_active FROM Clients
WHERE DATEVALUE(Date_active) >=   ?
ORDER BY  LN

Open in new window

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question