Index out of range exception vb.net -
i'm working on project need insert/search/add to/from m.s access
datatable
textboxes
.
search based on id
, while trying insert data onto textboxes error
index out of range exception: mobile number"
cn.open() comand.connection = cn comand.commandtext = "select * address_table id=@id" comand.parameters.add("@id", oledbtype.numeric).value = textbox1.text dim dr oledbdatareader = comand.executereader() while dr.read() = true textbox2.text = dr("name") textbox3.text = dr("house name") textbox4.text = dr("city") textbox5.text = dr("mobile number".tostring) textbox6.text = dr("pincode".tostring) textbox7.text = dr("email") loop if dr.read() = false messagebox.show("enter valid id") end if dr.close() catch ex exception messagebox.show(ex.tostring) cn.close()
any appreciated. thank in advance
this:
textbox5.text = dr("mobile number".tostring)
should this:
textbox5.text = dr("mobile number").tostring
and really, expect column name isn't quite right. may need escape space somehow.
Comments
Post a Comment