SQL Syntax


Author
Message
LeRoy Jackson, Jr.
LeRoy Jackson, Jr.
StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)
Group: Forum Members
Posts: 14, Visits: 55
Ok I know that this is very simple but I can't figure it out.

I am using SQLExpress and I have a table called Library.  I have a BO call Library1.  I created a method called FillByDate.

The column on my table that I want to look at is media_date it is of DataType DateTime.

my SQL is: "Select * from library where Media_date = @ldDate"

 ldDate = cdate("10/15/2006")

I am also new to Sql Server so My Question is what date conversion function do I need to get my parameter and my Table.DateTime Field to work. 

PS, I don't know what the actual time would be...Just the Date

Replies
LeRoy Jackson, Jr.
LeRoy Jackson, Jr.
StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)
Group: Forum Members
Posts: 14, Visits: 55
So should I have set up the table a different way?  Is there a Date that doesn't have the time attached to it in SQL Server?
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Nope, all dates in SQL Server have the time attached to them.

If you're setting the value in your default values, you can do this instead:

me.myfield = DateTime.Now.Date

Accessing the .Date property of a DateTime will return the date with the time truncated (alternatively, you could use the .TimeOfDay property to access just the time portion).

However, if you're setting the property in other ways, you can customize the property in the BOMapper to set the data within the business object to the .Date of the value passed.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
LeRoy Jackson, Jr. - 19 Years Ago
LeRoy Jackson, Jr. - 19 Years Ago
StrataFrame Team - 19 Years Ago
LeRoy Jackson, Jr. - 19 Years Ago
StrataFrame Team - 19 Years Ago
Larry Caylor - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Larry Caylor - 19 Years Ago
Flavelle Ballem - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Larry Caylor - 19 Years Ago
Larry Caylor - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Larry Caylor - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search