473,385 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

date range problem

8
i have this problem
m using dataset
dataadapter and dataset

i would like to select a date range using a datetimepicker or monthcalendar. the data in my database for date is 05/01/2007 where 05 is the month and 01 is the date.



sqladapter.SelectCommand = New OdbcCommand("SELECT * from " & table & "where date between @from_date and @to_date", conn)



sqladapter.SelectCommand.Parameters.Add("@from_dat e", OdbcType.date, "date").Value = Me.DateTimePicker1.Value.ToShortDateString


sqladapter.SelectCommand.Parameters.Add("@to_date" , OdbcType.date, "date").Value = Me.DateTimePicker2.Value.ToShortDateString


i tried these codes but when was prompt error " date type cannot convert to int"

how do i solve the prob?
Jun 19 '07 #1
3 1260
kenobewan
4,871 Expert 4TB
Try converting to date before add them as parameter. HTH.
Jun 19 '07 #2
Plater
7,872 Expert 4TB
I always added dates as strings, SQL treated it correctly for date comparisons, insertions and updates
Jun 19 '07 #3
girl
8
thnx for all your reply...

kenobewan , you had mention to convert to date first meaning using convert function? or cast functions??

Plater, how do you display ur date in string? please teach me!

and lastly,

sqladapter.SelectCommand = New OdbcCommand("SELECT * from " & table & " where date between @from_date and @to_date", conn)

sqladapter.SelectCommand.Parameters.Add("@from_dat e", OdbcType.Date).Value = Me.MonthCalendar1.SelectionRange.Start.Date.ToStri ng
sqladapter.SelectCommand.Parameters.Add("@to_date" , OdbcType.Date).Value = Me.MonthCalendar2.SelectionRange.End.Date.ToString

sqladapter.Fill(ds, "" & table & "")

when i try this, it prompt me optional features to be implemented! ani ideas what error is this?

thnx!
Jun 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: androtech | last post by:
Hello, I'm looking for a function that returns a date range for a specified week number of the year. I'm not able to find functions like this anywhere. Any pointers/help would be much...
8
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
5
by: BlackFireNova | last post by:
I need to write a report in which one part shows a count of how many total records fall within the working days (Monday - Friday) inside of a (prompted) given date range, in a particular...
6
by: alexanderpope11 | last post by:
Hello, how do I write this SQL: I would like to check the Main table for invalid rows. An invalid row is: any row where the Start_date to stop_date range overlaps an invalid date in the Code...
18
by: dfetrow410 | last post by:
Anyone have some code that will do this? Dave
67
by: PC Datasheet | last post by:
Transaction data is given with date ranges: Beginning End 4/1/06 4/4/06 4/7/06 4/11/06 4/14/06 4/17/06 4/18/06 4/21/06 426/06 ...
3
by: Deano | last post by:
The short version; In short, given one date range (start and end dates) how can I find the period that overlaps with another date range? The long version; I have knocked up a little application...
2
by: grego9 | last post by:
I have a problem in Excel 2000. I have written some VBA code that transfers data from the current excel workbook to a file called "Deal Input2.xls". Everything transfers ok apart from the date in...
9
by: Mo | last post by:
After a little PHP education, my first project (to get my feet wet) is making an employee time-tracking program for our small business. *** ANY SUGGESTION, THOUGHTS, OR ADVICE WOULD BE WARMLY...
19
by: phill86 | last post by:
Hi I am re-posting this thread because it has become very confusing and I have got some way to solving the problem so it is a slightly different question from the initial thread. here is the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.