看板 Visual_Basic 關於我們 聯絡資訊
Dim person As New SqlCommand("SELECT * FROM schdule_view", TTSS_DB) Dim person_show As SqlDataReader = person.ExecuteReader() Dim i,x Dim f,g As String Dim arr_name(30) As String g = Session("SP_Username") i = 0 x = 0 while person_show.Read() arr_name(i) = person_show.item("sp7_13") i = i + 1 End While i=0 For i = 0 to 30 f = arr_name(i) if f = g Then Response.Write( "<b>" & f & "</b>" & "<br />") Else Response.Write( f & "<br />") End if Next i 以上是我撰寫的程式碼 可是 無論給他什麼測試值 他都無法進IF 只會跳到ELSE 目前為止 只有 if "AA"="AA"可以判斷 但是只要改成 if "AA" = f 就無法判斷了 有哪位高明的板友可以指點的嗎 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.136.155.128
alair99:有的時候是字串前後有空白喔 (被害好多次的人= =) 09/24 23:24
diuo:謝謝 我再試試看 09/25 01:31
fumizuki:Request、Database 等...讀出來的資料都用 Trim() 09/26 06:40
diuo:我試出來了 感謝 <_._> 09/26 15:43