Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2006

Tip: Looking for answers? Try searching our database.

Form Query and GridView for ASP.NET 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dm1608 - 18 Feb 2006 21:03 GMT
Hi all --

I'm rapidly learning ASP.NET 2.0 (never really did much .NET before...
mainly an ASP and PHP guy until now) and seem to be having some technical
challenges that I'm hoping someone can help me with.

I've created an n-tier application that consists of a Business Access Lay
and a Data Access Layer to query a SQL Server database.  The classes are
stored within my App_Code directory.

The application is a rewrite of one of my earlier ASP applications where I
have a form that a user selects various checkboxes and dropdown lists and/or
types in a text string that will query a database and return all rows that
match that criteria.

One of the changes that I'm making is adding Peter Blum's DataTextBox
controls for a "Start" and "End" date prompt to be used to filter records by
date.

The issue that I'm having is that for some reason, when a user enters a date
such as "02/18/2005" and Peter's DateTextBox.Text property shows
"02/18/2005" and this is the property that I bound my ObjectDataSource to
for the GridView that I'm using.  When the date gets passed to my BAL, it is
showing as "02/18/2005 12:00:00 AM".  I've tried changing the data type of
the "StartDate" variable to be of type string instead of DateTime and I'm
still getting the same results.

This is causing me issues because if the user wants to query all rows for
today, the StartDate will be 02/18/2005 12:00:00 AM and the EndDate will
also be 02/18/2005 12:00:00 AM which causes no rows to be returned.

I want to somehow get rid of the time and add it to my DAL's SQL
statement... to use 12:00:00 AM for the start time and 23:59:59 for the end
time.

Has anyone else experienced these sort of issues before.

I have even tried changing all my references to StartDate and EndDate to be
of type string...  Howver, when I try and do an Add() method to my generic
collection, an exception is thrown about not being able to convert a
DateTime type to a string type; even though I typed-casted the field to a
string.

Any help would this would be appreciated.
Otis Mukinfus - 19 Feb 2006 20:29 GMT
>Hi all --
>
[quoted text clipped - 40 lines]
>
>Any help would this would be appreciated.

When you get the DateTime values from the control, try this:

Assuming the date are DateTime objects:

if the End date is MM/dd/yyy 00:00:00 AM, leave it alone.  Then do this: EndDate.AddHours(24);

Now you have a date time range that includes all 24 hours of the end points.

Is that what you want?

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.