Primary Field and SqlDataAdapter

From: Lev Burov (LevBurov_at_discussions.microsoft.com)
Date: 11/24/04


Date: Wed, 24 Nov 2004 09:01:10 -0800

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: sp_adduser (Add Windows Group ?)
    ... To give previlage to OS group to SQL Server. ... Command to give access previlage to the user to database. ... EXEC sp_grantdbaccess '','RPTGROUP' ... > Windows group to SQL Server database logins? ...
    (microsoft.public.sqlserver.server)
  • ADP question
    ... I have an Access 2002 ADP project with a connection to a ... SQL Server database. ... a command button from the toolbox) I get the Access mdw ...
    (microsoft.public.access.security)
  • security on ADP
    ... I have an Access 2002 ADP project with a connection to a ... SQL Server database. ... a command button from the toolbox) I get the Access mdw ...
    (microsoft.public.access.adp.sqlserver)
  • Re: OSQL Query
    ... > I am running a large batch update of a series of stored procedures on my ... > SQL Server database using the command line OSQL.exe application ...
    (microsoft.public.sqlserver.programming)
  • Re: Printing single record to a report
    ... It saves any edits, checks there is a record to print, and then uses the ... rather than allenbrowne at mvps dot org. ... > information (this is filtered using the primary key Report ID). ... > What code do I need to place behind the command button to achieve this? ...
    (microsoft.public.access.reports)