Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 2nd, 2005, 11:17 AM
Authorized User
 
Join Date: Oct 2005
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Switching to a dataset did work. Thank you for the help. That being said, can anyone explain why it worked w/ the dataset and not the datareader.

 
Old November 2nd, 2005, 03:16 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I think what you have to do is loop though the reader and ADD the Items dynamically to the dropdownlist.
Somthing like:

Do While myReader.Read()
   dropdownlist.Items.Add(<datareader value>)
Loop

That should get you started

 
Old November 2nd, 2005, 04:21 PM
Authorized User
 
Join Date: Oct 2005
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm just going to use the dataset, but I don't think the loop is the answer. I have 6 other dropdowns on this page and they are all working fine with the datareaders. I am in a similar situation to you in that I have used datasets for the majority of what I have done in the past. I had seen a couple of examples using the datareaders and thought I'd give them a try. I guess it's just better to stick w/ what you know sometimes.

 
Old November 2nd, 2005, 04:41 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Not sure why it's not working for that specific one, but it the dataset works, you may as well use it.

Jim

 
Old November 2nd, 2005, 04:48 PM
Authorized User
 
Join Date: Oct 2005
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Using your suggestion:

string CommandTextDate = "Select DISTINCT(Convert(Char(10), <col name>, 101)) from johnrose.smileReportview


is there a way that I could add one day to the date being chosen?

I am pulling the date from a ddl.

Variable = ddl.SelectedItem.Text;

I am trying to get a date range and it is returning one day short of what I want for some reason. If I ask for 10-24-2005 through 10-26-2005, it is returning the 24th and 25th.

An easy fix would just be to add a day to the enddate. Is there a way to do that with the formatting you suggested?

 
Old November 2nd, 2005, 05:39 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What is the SQL you are using for your daterange. Normially I use BETWEEN

 
Old November 2nd, 2005, 05:44 PM
Authorized User
 
Join Date: Oct 2005
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have tried ">= x and <= y" and I've tried Between. I get the exact same result either way. Here is what I am currently using.

 WHERE (Date_Time >= '"+ddlStartDate.SelectedItem.Text +"')
     AND (Date_Time <= '"+ddlEndDate.SelectedItem.Text +"')

 
Old November 3rd, 2005, 01:18 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

When you select a value from the dropdowns what are the values. Do a response.write to show the actual values.

 
Old November 7th, 2005, 02:05 PM
Authorized User
 
Join Date: Oct 2005
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry it to so long to respond. I am being pulled 5 directions here right now.

I did the response.write and I am getting the correct dates. But I am not getting the correct dates shown still. It is giving me one too few days.

 
Old November 7th, 2005, 02:11 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Use:
"WHERE Date_Time BETWEEN " + ddlStartDate.SelectedItem.Text + "AND" + ddlEndDate.SelectedItem.Text

If you still don't get the desired results, response.write the whole sql statment. Then run that sql statement in query analyzer.





Similar Threads
Thread Thread Starter Forum Replies Last Post
date format differs, need to force format somehow patricolsson ASP.NET 2.0 Basics 1 December 3rd, 2009 12:53 AM
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 03:17 PM
How to give Date format while entering date Subuana Beginning VB 6 4 March 17th, 2006 07:25 AM
date format differs, need to force format somehow patricolsson HTML Code Clinic 2 January 12th, 2006 05:55 AM
Access SQL Statement to Format a Dropdown List jonesl3 Access 3 November 24th, 2004 10:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.