|
-
Mar 14th, 2004, 04:40 AM
#1
Thread Starter
Member
Database and asp.net (VB)
I was using the calendar feature whereby the user allows to clicks on the specific date.
E.g: 13/3/2004 (Saturday). I would like to know whether asp.net has the function to call the Monday, Tuesday …. Sunday? If there is, could someone give sample of it as I do not know how to start. Thankz.
If there isn’t a function to call the Monday, Tuesday…. Sunday, I’m thinking of using the database function :
SET DATEFIRST 1
SELECT DATEPART(dw, getDate()) AS 'Today'
But the problem lie here. How to pass the selected date from the calendar to the database for checking whether it is which day?
I am really thankful to those who help me out.
-
Mar 15th, 2004, 04:47 AM
#2
You can use .dayofweek with any date or datetime object such as
VB Code:
Dim tempDate As DateTime
tempDate = Now
If tempDate.DayOfWeek = DayOfWeek.Monday Then
'it's monday
ElseIf Now.DayOfWeek = DayOfWeek.Tuesday Then
'It's tuesday
Else
'it's not
End If
-
Mar 15th, 2004, 10:48 AM
#3
Thread Starter
Member
Thank You Fishcake!!
I have succed in retrieving information from the database. However i hope that i can pass the information to the label insead of datagrid. Can it be done by passing information from the database to the label?
Here is how i pass to the datagrid:
objCmd.commandtext = "spDateChecking"
objCmd.CommandType = CommandType.StoredProcedure
objCmd.connection = dbconn
objParam = objCmd.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
objParam.Direction = ParameterDirection.ReturnValue
objCmd.Parameters.Add("@SlotDateID", weekday_value)
Dim myReader As OleDbDataReader
myReader = objCmd.ExecuteReader
If (myReader.HasRows) Then
Dim result As Integer
result = objCmd.Parameters("RETURN_VALUE").Value
dgTicketPrice.DataSource = myReader
dgTicketPrice.DataBind()
End If
'Close the connection object
dbconn.Close()
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|