Re: Primary Field and SqlDataAdapter

From: Val Mazur (group51a_at_hotmail.com)
Date: 11/24/04


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 


Relevant Pages

  • Re: Problem when redeined macro for floats with usepackage{color}
    ... tables) so that single spacing is used. ... % - User can specify draft copies, ... The \beforepreface command creates the title page, ...
    (comp.text.tex)
  • Re: Problem when redeined macro for floats with usepackage{color}
    ... % - User can specify draft copies, ... The \beforepreface command creates the title page, ... % so that single spacing is used. ...
    (comp.text.tex)
  • RE: DTS and stored procedure
    ... There is a command prompt utility "dtsrun". ... The DTS package can be stored in the Microsoft® SQL Server™ ... Specify server_name to ... Displays the encrypted command used to execute the DTS package without ...
    (microsoft.public.sqlserver.dts)
  • Re: not in domain
    ... You can use the netdom command as long as you have admin credentials on the ... NETDOM JOIN Joins a workstation or member server to the domain. ... If you specify a domain controller, ... VBScript & Windows PowerShell Training - ...
    (microsoft.public.scripting.vbscript)
  • Re: A Solution
    ... The syntax of the command is incorrect. ... /G user:perm Grant specified user access rights. ... Wildcards can be used to specify more that one file in a command. ... CI - Container Inherit. ...
    (microsoft.public.windowsmedia.player)