Re: Primary Field and SqlDataAdapter
From: Val Mazur (group51a_at_hotmail.com)
Date: 11/24/04
- Next message: Val Mazur: "Re: Windows XP SP2 MDAC 2.8 SP1"
- Previous message: Val Mazur: "Re: List of ADO Errors"
- In reply to: Lev Burov: "Primary Field and SqlDataAdapter"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Nov 2004 18:46:50 -0500
Hi Lev,
What you could do is to place this logic inside of the stored procedure and
pass parameters (field values) as a parameters of it. Then you could specify
same SP name for updates and insert for your DataAdapter. In this case DA
will call SP in any case, but inside of SP you will check if data actually
should be inserted or updated.
-- Val Mazur Microsoft MVP "Lev Burov" <LevBurov@discussions.microsoft.com> wrote in message news:E7FD615A-B13B-4194-8894-71DBD566161D@microsoft.com... > Hi All, > > I have a fairly simple problem I can't find an answer to: > > I'm using SqlDataAdapter.Update() function to update my SQL Server > database > with a DataTable. I want it to look at the rows in the DataTable and if > the > particular field called IDCode(varchar) is found in the DB table then I > want > the DataAdapter to use it's update command, if not then I want it to > insert a > new row using the insert command. > > Now here's the problem: I set up both commands update and insert, but I > don't know where to specify with the SqlDataAdapter to look for this one > field that acts as a primary key in the table. Can someone help? > > Thanks, > Lev > -- > *** > Porky said it
- Next message: Val Mazur: "Re: Windows XP SP2 MDAC 2.8 SP1"
- Previous message: Val Mazur: "Re: List of ADO Errors"
- In reply to: Lev Burov: "Primary Field and SqlDataAdapter"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|