c# - Check record state of a database entry -


i'm writing hardware inventory application. data computer through wmi , write database linq.

eventually end record like:

id  hostname    os         memory     1  myhostname  windows 7  4gb 

now imagine add memory computer , next time application finds it, have information computer updated , try write database.

before writing check if hostname present on database (it primary key), in case exists. now, query database hostname , information have computer , create object , compare object got wmi ?

isn't there way create value on table based on each record information , have linq create 1 based on wmi object , compare each other?

sorry if text little confusing, hope guys can me out this.

try this.

var entry = yourcontext.yourtable.singleordefault(e => e.hostname == somehostname); 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -