I am accessing a MS SQL2000 database. The table has a date field setup as 'Datetime' I then setup a data adapter (VB.Net, windows) as follows
daEmpDiv = New SqlClient.SqlDataAdapter("SELECT EmployeeID, DivisionID, SubDivision_ID FROM tblEmpDivisionDates WHERE EmployeeID = 17 AND Start_Date <= " & Today(), conn
When done no records are retrieved, but when I remove the start_date condition the records are retrieved. I know that I am missing something simple, but I unable to see it. Any help would be greatly appreciated
Thanks, JR :) 4 1530
Change it to Start_Date <= GetDate()
"JR" <an*******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com... I am accessing a MS SQL2000 database. The table has a date field setup as
'Datetime' I then setup a data adapter (VB.Net, windows) as follows: daEmpDiv = New SqlClient.SqlDataAdapter("SELECT EmployeeID, DivisionID,
SubDivision_ID FROM tblEmpDivisionDates WHERE EmployeeID = 17 AND Start_Date
<= " & Today(), conn) When done no records are retrieved, but when I remove the start_date
condition the records are retrieved. I know that I am missing something
simple, but I unable to see it. Any help would be greatly appreciated. Thanks, JR :)
Change it to Start_Date <= GetDate()
"JR" <an*******@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com... I am accessing a MS SQL2000 database. The table has a date field setup as
'Datetime' I then setup a data adapter (VB.Net, windows) as follows: daEmpDiv = New SqlClient.SqlDataAdapter("SELECT EmployeeID, DivisionID,
SubDivision_ID FROM tblEmpDivisionDates WHERE EmployeeID = 17 AND Start_Date
<= " & Today(), conn) When done no records are retrieved, but when I remove the start_date
condition the records are retrieved. I know that I am missing something
simple, but I unable to see it. Any help would be greatly appreciated. Thanks, JR :)
JR <an*******@discussions.microsoft.com> wrote: I am accessing a MS SQL2000 database. The table has a date field setup as 'Datetime' I then setup a data adapter (VB.Net, windows) as follows: daEmpDiv = New SqlClient.SqlDataAdapter("SELECT EmployeeID, DivisionID, SubDivision_ID FROM tblEmpDivisionDates WHERE EmployeeID = 17 AND Start_Date <= " & Today(), conn)
When done no records are retrieved, but when I remove the start_date condition the records are retrieved. I know that I am missing something simple, but I unable to see it. Any help would be greatly appreciated.
Instead of embedding the date directly in the SQL, use a parameter and
set the value of that parameter to today's date. That way you won't
need to worry about conversions and formatting, etc.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
JR <an*******@discussions.microsoft.com> wrote: I am accessing a MS SQL2000 database. The table has a date field setup as 'Datetime' I then setup a data adapter (VB.Net, windows) as follows: daEmpDiv = New SqlClient.SqlDataAdapter("SELECT EmployeeID, DivisionID, SubDivision_ID FROM tblEmpDivisionDates WHERE EmployeeID = 17 AND Start_Date <= " & Today(), conn)
When done no records are retrieved, but when I remove the start_date condition the records are retrieved. I know that I am missing something simple, but I unable to see it. Any help would be greatly appreciated.
Instead of embedding the date directly in the SQL, use a parameter and
set the value of that parameter to today's date. That way you won't
need to worry about conversions and formatting, etc.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jeff |
last post by:
IDE: VS 2003 :NET
OS: XP Pro
My app have a form with a tab-control on it. The tab-control have 2
tabpages. One of the tabpages displays a datagrid, and the other tabpage
displays details (order...
|
by: compuglobalhypermeganetz0r |
last post by:
I am having trouble getting an adapter to update my access database, it
gives the error Syntax error in INSERT INTO statement. for
Line 98: Adapter.Update(WineDS, "tblWines")
Below is my...
|
by: pmud |
last post by:
Hi,
I have 2 drop down lists on an asp.Net page. The 1st contains alphabets.
When the user selects an alphabet frm the first list, the second drop down
list should be populated with names from...
|
by: Al Gerharter |
last post by:
Hi,
I'm building a form, and tying it to a database via SQL connection,
SQLdataadapter, and a Dataset. It appears that the data adapter will not let
me select more than 100 fields in the SQL...
|
by: Keith Kuwatani |
last post by:
I am using the ODBC .net provider against a pervasive 2000i database.
The Data Adapter successfully generates Table Mapping, Select Statement and
Insert Statement.
However, the Update and Delete...
|
by: Zorpiedoman |
last post by:
Up to this point, I have avoided using the Data Adapter to do my updates back
to the database. I found it more straight forward to build my own SQL
statements, and just execute them directly.
...
|
by: Brad Baker |
last post by:
I'm trying to write a simple asp.net page which updates some data in a SQL
database. At the top of the page I have the following code:
<%@ Page Language="C#" Debug="true" %>
<%@ import...
|
by: Simon |
last post by:
Hi all,
I'm having a baffling problem with a windows service that I'm working on.
Basically, I am using a typed dataset to insert a large number of rows
into an SQL Server 2005 database. But...
|
by: Usman Jamil |
last post by:
Hi
I've a class that creates a connection to a database, gets and loop on a
dataset given a query and then close the connection. When I use netstat
viewer to see if there is any connection open...
|
by: M |
last post by:
I have the some troubles.
I have a VBNET Project version 7.0.9466. Microsoft Visual Basic .NET
55524-640-2187145-18548
I have SQL 2005 and SQL 2000 in different remote computers.
When I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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: 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,...
|
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...
|
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...
| |