Re: Dates

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Do you just send the date as a string to the database, or is it converted to a DateTime at any stage?

Frederik Vanderhaeghe wrote:
Hi,

I have made a search page on which users can search for documents. They can search by documentnumber, customername,... and also by date. Now the problem is that when a date is entered it doesn't show anything.

When I look at the SQL server Enterprise management and make a query there, the following works:
select *
from TBL_Bestanden_Zoeken
where (datum='2005-12-31')

When I code it like that in my asp.net site, that when the field is not empty, it searches for the documents with date='2005-12-31' then it doesn't give any results.

What can I do?

Fré


.



Relevant Pages

  • Re: Dates
    ... The SQL query is a string, so the date in it is a part of the string, not a separate DateTime value. ... Frederik Vanderhaeghe wrote: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: datetime sorting in datagrids
    ... database, with the field set as a Date. ... seems to be as a string. ... >> I have a dataset that contains, as one column, DateTime ...
    (microsoft.public.data.ado)
  • Re: DTS Parameters
    ... Must you pass the date as a String or Date? ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... the designers of the source database is> storing the postdate and trip date as a varchar rather> than a datetime datatype. ... The destination database is a> Reporting database we have setup to alleviate some> reporting issues we have. ...
    (microsoft.public.sqlserver.dts)
  • Re: having an issue with date formats
    ... I have left/right and sub'd string to get the values of the day, ... I also need to insert this into a SQL database. ... Use the SqlCommand's Parameters property to pass the DateTime value to the SQL command, so you don't have to care about the format at all. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: datetime sorting in datagrids
    ... If this is a string then what kind of database are you using? ... > I have a dataset that contains, as one column, DateTime ... The standard string sorting ...
    (microsoft.public.data.ado)