sql - Update grid from a query -
i have visual basic 2010 application uses datagridview display list of frequencies microsoft access 2010 database. application uses bindingnavigationpostionitem allow navigation though table.
the move next , move previous buttons move , down list. cool thing is, this, have code sends frequency , mode yeasu radio , radio set freq/mode.
this works great but, if try filter datagridview service field, id field becomes blank , navigation not work.
here code runs after select want filter , click filter button:
private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim cmbox1 string cmbox1 = combobox1.text myconn = new oledbconnection myconn.connectionstring = connstring ds = new dataset tables = ds.tables da = new oledbdataadapter("select * hfutil service = '" & cmbox1 & "'", myconn) ' da.fill(ds, "hfutil") dim view new dataview(tables(0)) source1.datasource = view datagridview1.datasource = view bindingnavigator1.bindingsource = source1 datagridview1.refresh() bindingnavigator1.refresh() '========================================================= listbox1.items.clear() listbox1.text = "" each dr datarow in ds.tables(0).rows dim sitemtemp string sitemtemp = string.format("{0} {1} {2}", dr("freq"), dr("mode"), dr("desc")) listbox1.items.add(sitemtemp) next combobox2.items.clear() combobox2.text = "" each dr datarow in ds.tables(0).rows dim sitemtemp string sitemtemp = string.format("{0} {1} {2}", dr("freq"), dr("mode"), dr("desc")) combobox2.items.add(sitemtemp) next end sub the difference between code , code runs on form load - clause in data adapter.
what doing wrong?
i don't see in code apply filter. so, lets pretend second load whole table dataset. next thing, either use dataset.defaultview or create custom dataview , assign datasource property - did this.
now, have apply row filter data view use
view.rowfilter = "service = '" & cmbox1 & "'" at point should see subset of records , nothing should happen id field. because data doesn't change.
i have suspicion, changing view somewhere , why have problems.
Comments
Post a Comment