Home > Software engineering >  Vb command. Why can't read the read data in the text?
Vb command. Why can't read the read data in the text?

Time:12-19

Str6 Texas at the time of the for loop has received these two characters, but it is in the database can't Read data (on rs. Read () won't be able to attend), if the str6="Texas" can directly Read data, why is this?
For I=2 To 20
Str6=TextBox1. Text. The Substring (I, 2)
If str6 & lt;> "" Then
Call OpenConn ()
Command1.Com mandText="select distinct province, city from dbo. PCC where city2=" & amp; "'" & amp; Str6 & amp; "'
"Command1.Com mandType=CommandType. Text
Rs=Command1. ExecuteReader ()
If the rs IsNot Nothing Then
Rs. The Read ()
If the rs. HasRows Then
If ComboBox1. Text="" Then
ComboBox1. Text=rs. Get string (0)
End the If
ComboBox2. Text=rs. Get string (1)
If the rs IsNot Nothing Then
Call CloseConn ()
End the If
The Exit For
End the If
End the If
End the If
Next
  • Related