下面是用於將數據提取到文本框中的代碼,但它不工作它顯示錯誤沒有數據退出行/列而數據和數據字段是完全正確的。 請幫忙。從asp.net中的數據庫檢索數據使用vb
Dim Connection As OleDbConnection
Connection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/db/QardanHasana.mdb"))
Connection.Open()
Dim ejamaatregcmd As OleDbCommand
Dim ejamaatregdtrdr As OleDbDataReader
ejamaatregcmd = New OleDbCommand("SELECT ITSData.[EJamaatID], ITSData.[ITSFirstName] FROM ITSData WHERE EjamaatID= @EjamaatID", Connection)
ejamaatregcmd.Parameters.Add(New OleDbParameter("@EjamaatID", txtEjamaatID.Text))
ejamaatregdtrdr = ejamaatregcmd.ExecuteReader()
If ejamaatregdtrdr.HasRows Then
txtFirstName.Text = ejamaatregdtrdr.item("ITSFirstName").ToString()
end if
您可以添加確切的錯誤得到? – peter