我找回我的MainForm:登錄後出現錯誤:「已經有一個打開的DataReader與此連接關聯,必須先關閉該連接?」
Try
rs.Connection = con
cmd = "select * from cdcol.currency_rate"
rs.CommandText = cmd
res = rs.ExecuteReader
While res.Read
Dim currency = res.GetString("currency")
ComboBox2.Items.Add(currency)
End While
res.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
,這在我的TabControl
Try
rs.Connection = con
cmd = "select * from cdcol.currency_rate where currency='" & ComboBox2.Text & "'"
rs.CommandText = cmd
res = rs.ExecuteReader
While res.Read
If sell.Checked = True Then
buy.Text = res.GetDouble("buy_rate")
coderate.Text = res.GetString("code")
End If
If buy.Checked = True Then
sell.Text = res.GetDouble("sell_rate")
coderate.Text = ("PHP")
End If
End While
res.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
當我登錄時出現錯誤, 有什麼錯我的代碼? 請幫助我..