This is a SQL question, not really a C# question. And if memory
serves it's a conventional question any book can answer. You have to
play around with your code a bit more, that's all. And you should
learn the ADO.NET Entity Framework, which will make the dinosaur SQL
macro language obsolete in a few years anyway.
RL
It is a .NET framework library question - it has nothing to do
with SQL.
> And if memory
> serves it's a conventional question any book can answer.
I don't think so.
> And you should
> learn the ADO.NET Entity Framework, which will make the dinosaur SQL
> macro language obsolete in a few years anyway.
SQL is not a macro language.
It is well known that ORM's are good for many purposes but not
good for all purposes. SQL will also be used in the future.
Arne
Yeah, what Arne said. So does anyone have any idea how to suppress
the Update functionality of the .NET Framework SqlDataAdapter object
so that it performs only Inserts and ignores existing records?
Look it up in a textbook. An INSERT is just that. An UPDATE is just
that. One is for new records and the other is for existing records.
C'mon, do some work. You're wasting more time here than you could
solving the problem.
RL
You're killing me Ray. If you don't understand the question that I'm
asking then don't respond. Trust me, I understand the difference
between an INSERT and an UPDATE. What I don't understand is how to
get this particular .NET Framework object to use them the way I want.
I have read the documentation and it does not clear things up. I have
googled high and low and not found the answer. I use these groups as
a last resort to answer questions that I can't seem to dig up
elsewhere.
foreach( MyKindOfRow r in myDataTable.Rows)
{
switch (r.RowState)
{
case System.Data.DataRowState.Added:
...
myTableAdapter.Update( r) ; // add the record
...
break;
case System.Data.DataRowState.Deleted:
...
myTableAdapter.Update( r) ; // delete the record
...
break;
case System.Data.DataRowState.Modified:
case System.Data.DataRowState.Unchanged:
case System.Data.DataRowState.Detached:
// do nothing
break;
default:
throw new Exception("Unexpected RowState value.");
}
}
but observe that your row will still be in a state of being 'modified', so
don't blindly Update the row explicitly (or implicitly) somewhere else, the
effect would be that the modified row would then be updated.
Vanderghast, Access MVP
"Stu" <stum...@gmail.com> wrote in message
news:d58f31ba-6018-4f6f...@s31g2000yqs.googlegroups.com...
LIke Vanderghast said, it's in any book, like the ones by Sceppa.
Sceppa even has a book now on the Entity Framework, and I might get it
since the first books out really sucked.
RL