While reader.Read()
           
            ' TextBox5.Text += reader.GetString(5)
            'TextBox4.Text += DropDownList2.SelectedItem.Value
                       
           If reader.GetString(5) = DropDownList2.SelectedItem.Value Then
                TextBox5.Text = "ok"
            Else
                TextBox5.Text = "no"
               
            End If
                     
  End While
     
想請問這樣哪裡有錯??
這樣他不會跟資料庫裡的比對
但是單獨抓就有抓到值,資料庫有抓到,選單也有抓到,
但是做比對確沒有做反應請問問題在哪!??!?

解决方案 »

  1.   

    reader.GetString(5).toString() == DropDownList2.SelectedItem.Value 
      

  2.   

    不用== ,vb.net的语法用=就可以了
    问题出在哪你最好调试一下
    看看reader.GetString(5)的值
      

  3.   

    reader.GetString(5)的值
    單抓是沒已問題的
    那樣改也不行,><"
    還有其他錯??
      

  4.   

     While reader.Read() 
    If DropDownList2.SelectedValue = "A" Then
          TextBox5.Text = reader.GetString(5)
                                 
     End IfExit While
     End While
    這樣可以抓到值,可是可以寫多筆??我有寫兩個IF
    可是有問題!!請問要怎樣寫成多筆