| | |
Change image position according to system time.
Please support our MS SQL advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 37
Reputation:
Solved Threads: 0
Hi I have made a website where it is possible to see the days program on one page, it updates itself so it is only for that day.
But now I wan't to be able to insert a picture that changes position according to what time it is.
For example if the time is 1pm. then the small picture should move down to 1pm.
and if the time is 3pm the picture moves down to 3pm.
Maybe you can see what I meen on:
http://radio.web.surftown.dk/default.aspx
the time is written as datetime in my ms sql database.
my code on my aspx page looks like this:
and my code on the codebehind page looks like this:
I hope you understand what I meen and that you can help me?
But now I wan't to be able to insert a picture that changes position according to what time it is.
For example if the time is 1pm. then the small picture should move down to 1pm.
and if the time is 3pm the picture moves down to 3pm.
Maybe you can see what I meen on:
http://radio.web.surftown.dk/default.aspx
the time is written as datetime in my ms sql database.
my code on my aspx page looks like this:
MS SQL Syntax (Toggle Plain Text)
<%# Eval("tid", "{0:t}")%>
and my code on the codebehind page looks like this:
MS SQL Syntax (Toggle Plain Text)
SqlConnection objconn = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstring"].ToString()); SqlCommand objcmd = new SqlCommand(); objcmd.Connection = objconn; objcmd.CommandType = CommandType.Text; IF (DateTime.Now.Hour > 3) { objcmd.CommandText = "SELECT * FROM PROGRAM WHERE CONVERT(VARCHAR, date, 105) = CONVERT(VARCHAR, GETDATE(), 105)"; SqlDataReader reader = NULL; objconn.Open(); reader = objcmd.ExecuteReader(); program.DataSource = reader; program.DataBind(); objconn.Close(); } else { objcmd.CommandText = "SELECT * FROM PROGRAM WHERE DATE = DATEADD(day, DATEDIFF(day, 1, GETDATE()), 0)"; SqlDataReader reader = NULL; objconn.Open(); reader = objcmd.ExecuteReader(); program.DataSource = reader; program.DataBind(); } }
I hope you understand what I meen and that you can help me?
•
•
Join Date: Dec 2008
Posts: 37
Reputation:
Solved Threads: 0
I think that this might be a way to do it?
my column in my ms sql Db that the system time has to be the same as is called tid.
So I have a suspicion that it could be done something like this:
But I know that it should be written in a different way, and I am not even sure i'm on the right track.
I hope someone can please help me?
my column in my ms sql Db that the system time has to be the same as is called tid.
So I have a suspicion that it could be done something like this:
MS SQL Syntax (Toggle Plain Text)
objcmd.CommandText = "SELECT tid FROM PROGRAM CONVERT(VARCHAR, GETDATE(), {0:t})"; AND then later make an IF sentence. IF(tid == getdate() "{0:t}") { INSERT picture WITH img src="x"; }
But I know that it should be written in a different way, and I am not even sure i'm on the right track.
I hope someone can please help me?
Last edited by kischi; Feb 4th, 2009 at 1:15 pm.
My friend it's not related to MS SQL Server
it's about how can you play with the datetime value returned from SQL Server, as SQL Server returns the value, the problem is over here, and you can post this question to ASP.NET forum, you'd get fast response there.
Best of luck!
it's about how can you play with the datetime value returned from SQL Server, as SQL Server returns the value, the problem is over here, and you can post this question to ASP.NET forum, you'd get fast response there.Best of luck!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Mark it as solved please!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Similar Threads
- SpeedUp Your Window XP Never Than Before (Windows tips 'n' tweaks)
- I need a great web designer and proffesional PHP Coder ~ 10k project (Web Development Job Offers)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- Floating/scrolling image? (JavaScript / DHTML / AJAX)
- Open In New Window Php (PHP)
- Java Game Characteristics (Java)
- Java Game Characteristics (Java)
- I lack focus... (Java)
Other Threads in the MS SQL Forum
- Previous Thread: Change table name in sql express
- Next Thread: SQL server 2008 express question
| Thread Tools | Search this Thread |






