Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL With Date
Message
From
25/05/2003 10:41:14
 
General information
Forum:
ASP.NET
Category:
Databases
Title:
Miscellaneous
Thread ID:
00792639
Message ID:
00792667
Views:
21
Ahmad,

Are you sure you get an error with this? SQL recognizes date "strings" as Dates. What error are you getting?

~~Bonnie


>Hi Cathi,
>
>I can't include .ToString() in the quary, because the "DateIn" field is a date type.
>I get a conversion error if I add it.
>
>
>>Hi Ahmad,
>>
>>Try changing the select statement to the following:
>>
>>
>>Dim myAttendanceSql As String = "SELECT * FROM AN_CheckInOut WHERE Mem_EmpID = '" & Trim(Me.txtID.Text) & "' AND DateIn = '" & Date.Today.ToString() & "'"
>>
>>
>>Also keep in mind that SQL Server uses DateTime and not just Date. Therefore your DateIn expression must match both the date portion and the time portion exactly.
>>
>>>Dear All,
>>>
>>>Am I missing somthing with this SQL statment:
>>>
>>>Dim myAttendanceSql As String = "SELECT * FROM AN_CheckInOut WHERE Mem_EmpID = '" & Trim(Me.txtID.Text) & "' AND DateIn = " & Date.Today
>>>Dim myAttendanceDA As New SqlDataAdapter(myAttendanceSql, myConn.oAdoNetSql_Conn)
>>>Dim myAttendanceCB As New SqlCommandBuilder(myAttendanceDA)
>>>
>>>
>>>It return 0 rows if I included the date in the query. and no errors!
>>>
>>>I am using SQL2000 MSDE.
>>>
>>>Thanks for the help.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform