Private Sub Button1_Click(ByVal sender as object ,byval e as system.events)Handles Button1.Click
Dim a,b as string
Dim StrConnect as string
Dim StrQuery as string
Dim myConnectStr as string
b=Text1.text
StrQuery="select Name,PWD,Root from UserInformation"
myConnectStr="Driver=SQL........"
Dim myConn as New Odbc.OdbcConnection(myConnectStr)
Dim myCommand as New Odbc.OdbcCommand(StrQuery,myConn)
myConn.Open()
Dim myReader as Odbc.OdbcDataReader
myReader=myCommand.ExecuteReader()
While myReader.Read()
a=myReader.Getstring(0) /myReader.Getstring(0)的值为string类型"James"
if a=b then
Label1.text="相等"
else
Label1.text="不等"
end if
end while
end sub
上面这一段,如果在Text1中输入"James"然后点击Button1的话,Label1显示不等
(此时a的值为“James”);而把a=myReader.GetString(0)改成a="James"后,再点击Button1
,Label1显示“相等”了,这是为什么呢?有什么不同吗?