plusone3055
asked on
Query Syntax
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_ValueChang ed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChang ed
Dim Date_active As Date = DateTimePicker1.Value
MembersTableAdapter.Fill(D sDataset.C lients, _
Date_Active)
End Sub
When I run it its showing all the records > ? but NOT records = ?
much appreciated easy 2000 pts
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_ValueChang
Dim Date_active As Date = DateTimePicker1.Value
MembersTableAdapter.Fill(D
Date_Active)
End Sub
When I run it its showing all the records > ? but NOT records = ?
much appreciated easy 2000 pts
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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_Activ e,103) >= ?
'103' is DD/MM/YYYY format, you can use other date formatting that you desired.
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_Activ
'103' is DD/MM/YYYY format, you can use other date formatting that you desired.
ASKER
figured it out time format was wrong in the database
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.
ASKER
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 :(
i think my suggestion works for the author problems.
try DATEVALUE to truncate the time part.
SELECT ID, LN, FN, Date_active FROM Clients
WHERE DATEVALUE(Date_active) >= ?
ORDER BY LN
ASKER
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