473,404 Members | 2,213 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,404 software developers and data experts.

data between two dates in asp.net2008

hi,
i am trying to fetch three fields from my table according to the two dates which will be given by the user in two text boxes in my form..
i am facing a problem..
my dates in the database is in the text format..
it is in the form of
10/10/2009
11/10/2009
12/10/2009
12/12/2009
now if i give two dates like 10/10/2009 in textbox1 and 12/10/2009 in textbox2 my datagrid shows allthe data including 12/12/2009...means it is not filtering the month...
my asp.net coding is like this
SELECT [Name], [Date], [TotalHrs] FROM [fabotentry] WHERE (([Date] >= ?) AND ([Date] < ?))

my vb.net coding is like this
select Name,Date,TotalHrs from fabotentry where Date between '" & tb1.Text & "' and '" & tb2.Text & "'"

what should i do now???
thanks
Nov 17 '09 #1
1 2166
Curtis Rutland
3,256 Expert 2GB
The best way to do this is to parse the entry in the TextBox into a DateTime object, then instead of using string concatenation to build raw SQL, use Parameters.

This will also help protect you from SQL Injection attacks.
Nov 17 '09 #2

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

Similar topics

2
by: Les | last post by:
Hi can anyone help me, I have just graduated and have started working for a building developer which deals with a large quantity of drawings. As you can imagine these all need documenting...
17
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). ...
9
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo...
0
by: mark4asp | last post by:
I have created two DropDownList controls on my form which I want to populate with data from an XML file (stored in the xml subdirectory) Here is the code I use. It does not work. I shows...
4
by: jdph40 | last post by:
I enter data into a database that resides on our network. Other employees can print reports from the database, but they have no way of telling if I've entered all the data. For instance, on...
0
by: Rick | last post by:
Access2003 Using the data below I want to create a chart with dates along the x axis. The chart is drawn but adds Dates not in my data table. How can I get the chart to use only the supplied...
0
by: Marc | last post by:
Hello, I have converted a project from .NET2005 to .NET2008 RTM I have also converted the project to use .NET Framework3.5 (as the project will only be in Beta in a few month). My project is...
9
by: LucasLondon | last post by:
Hi, Sorry, this is a bit of a lengthy one but I guess too much information is better than less! I have an excel worksheet that I update regulary with latest values from downloaded CSV files....
0
by: chanlichin | last post by:
Select Case (cbMonth.Text) Case "January" Dates = "1" Case "February" Dates = "2" Case "March"
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.