D
divisortheory
I used the Designer to generate Typed Dataset classes for every table
in a database I'm using. In one particular table, I use a numeric
Autonumber column as the primary key, 1 text column specifying a
friendly name, and some other miscellaneous columns. Given a string
representing a friendly name, I want to insert a new row if no such row
exists yet, and I want to get the existing row if such a row does
already exist. Then, with either the new row or the existing row, I
want to make some modifications on the row and save it to the database.
What's the most elegant way to do this? I can call .Select() on my
compiler-generated table class passing in the filter column, then check
if there's 0 rows, then add a new one or use the existing row, but my
gut tells me there's a more elegant way involving the adapters that I'm
not seeing. Sorry if this is a basic question, but being my first
experienec with Typed datasets and there's a ton of compiler generated
code that I have yet to fully understand.
Thanks
in a database I'm using. In one particular table, I use a numeric
Autonumber column as the primary key, 1 text column specifying a
friendly name, and some other miscellaneous columns. Given a string
representing a friendly name, I want to insert a new row if no such row
exists yet, and I want to get the existing row if such a row does
already exist. Then, with either the new row or the existing row, I
want to make some modifications on the row and save it to the database.
What's the most elegant way to do this? I can call .Select() on my
compiler-generated table class passing in the filter column, then check
if there's 0 rows, then add a new one or use the existing row, but my
gut tells me there's a more elegant way involving the adapters that I'm
not seeing. Sorry if this is a basic question, but being my first
experienec with Typed datasets and there's a ton of compiler generated
code that I have yet to fully understand.
Thanks