how to update specific cell in data grid view using SQL and VB.net -
i trying update specific cell in datagridview
using vb.net
, sql
( or other method) using code split somme strings , save database.
private sub salveazadata() dim list string() = rtbcomdata.text.split(environment.newline.tochararray()) smddatadataset1.searchadrese.rows.clear() smdtabletableadapter.clearsearchadrese() me.searchadresetableadapter.update(me.smddatadataset1.searchadrese) each row string in list if not (row = "at+dscan" or row = "ok" or row = "" or row = "at+rssi") dim s string() = split(row, "|") dim arow smddatadataset1.smdtablerow = smddatadataset1.smdtable.newsmdtablerow() arow.model = s(0) arow.adresaunica = s(1) arow.statusmodul = "active" try smddatadataset1.searchadrese.rows.add(s(1)) smddatadataset1.smdtable.rows.add(arow) catch ex exception dim u string u = smdtabletableadapter.updateinactivactiv() end try end if next 'selectzr() salveaza() status() datagridview1.refresh() end sub
the table has columns
model | adresa unica | status | time | instaddress | zr 123456 active zr 654321 active
what want update row address "123456" or "654321" , write in specific cell , in case cell column | time | value . can please me .?
i have made digging , have fund answer. please see below code i've used in application
private sub groupcommandrtime() dim list string() = rtbcomdata.text.split(environment.newline.tochararray())`enter code here` dim listaadrese list(of string) = getadreseid() each row string in list each _adresa string in listaadrese if not (row = "at+remote=" or row = "at+rssi" or row = "ok") try dim s string() = split(row, " ") dim con new sqlconnection dim cmd new sqlcommand con.connectionstring = "data source=.\sqlexpress;attachdbfilename=|datadirectory|\database\smddata.mdf;integrated security=true;user instance=true" con.open() cmd.connection = con cmd.commandtext = "update smdtable set datetime='" + s(3) + "' adresaunica = '" + s(0) + "'" cmd.executenonquery() me.smdtabletableadapter.fill(me.smddatadataset1.smdtable) datagridview1.refresh() catch ex exception end try end if next next end sub
Comments
Post a Comment