0
ASP.NET 탭 컨테이너의 headertext 이미지를 다른 색상으로 변경해야합니다. 예를 들어, 오늘 23/04/2014
이고 "FireTraffic"인 나의 탭 ImageUrl="~/icons/vwicn114.gif"
인 경우 2 일 안에 SQL Server에서 레코드를 업데이트해야하므로 ImageURL을 변경해야합니다. 그래서 그것을 TrafficLight 시스템으로 생각하십시오.2 개의 날짜를 비교하여 3 개의 결과를 제공합니다.
connection.Open()
command = New SqlCommand("Select TOP 1 [Due Date] From FireTest Order By [Due Date] Desc", connection)
Dim DueDate As String = command.ExecuteScalar()
Dim Mycommand As New SqlCommand("Select TOP 1 [Date] From FireTest Order By [Date] Desc", connection)
Mycommand = command.ExecuteScalar()
connection.Close()
그래서 내 코드가 될 것 같은 :
If mycommand "is 1 day more than" DueDate then firetraffic.ImageURL=Red
If mycommand "is 3 days or less than" DueDate then firetraffic.ImageURL=Yellow
End If
End If
난 그냥 분명히 때로 믿을 공간에 넣어해야 모르는
'여기에 도움이되는 코드의 조각은 이해입니다 t 코드, 답변에 대한 안내는 크게 감사하겠습니다.
'String'및 'Date'유형에 '-'연산자가 정의되지 않았습니까? ... – Kallumasaurus
"Date.Parse (dueDate)"또는 "CDate (dueDate)"를 사용하여 dueDate에 할당 할 값을 Date로 변환해야합니다. – GeoffWilson