 |
| 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
|
|
|
|

November 2nd, 2005, 11:17 AM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

November 2nd, 2005, 03:16 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
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
|
|

November 2nd, 2005, 04:21 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

November 2nd, 2005, 04:41 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Not sure why it's not working for that specific one, but it the dataset works, you may as well use it.
Jim
|
|

November 2nd, 2005, 04:48 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

November 2nd, 2005, 05:39 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
What is the SQL you are using for your daterange. Normially I use BETWEEN
|
|

November 2nd, 2005, 05:44 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 +"')
|
|

November 3rd, 2005, 01:18 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
When you select a value from the dropdowns what are the values. Do a response.write to show the actual values.
|
|

November 7th, 2005, 02:05 PM
|
|
Authorized User
|
|
Join Date: Oct 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

November 7th, 2005, 02:11 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
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.
|
|
 |