Anyway to Check if any datatable.Columns is added vb.net -
i have dataset datatable columns.
i fill dataset code in winforms
myadapter = new sqldataadapter("select * users", strsqlconn) myadapter.fill(dsdataset, "users") dcpk(0) = dsdataset.tables("users").columns("firstname") dcpk(1) = dsdataset.tables("users").columns("lastname") dsdataset.tables("users").primarykey = dcpk is anyway check if datatable.columns added vb.net? later in code example "amount" added
dsdataset.tables("users").columns.add("amount", system.type.gettype("system.int32")) what want - have alot of datasets , want see if real changes in them (not added columns whois not part of database) if not, dont save database.
when use getchanges says have changes if have added columns, added columns should excluded.
now have hardcoded added columns exclude them in check, works thats not way maintain. way make copy of datasets , compare them, in copy there no added columns. im not sure performance when alot of datasets...
like in rows
if row.rowstate = datarowstate.added 'do end if
you should able use getchanges() method of datatable object, so...
dim t datatable = mydatatable.getchanges() if t isnot nothing ' there changes table else ' there no changes table end if please sure read documentation page linked sure meets requirements.
Comments
Post a Comment