HighTechTalks DotNet Forums  

Problem adding records with SQLDataadapter to SQL Server database

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Problem adding records with SQLDataadapter to SQL Server database in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Rob Smeets
 
Posts: n/a

Default Problem adding records with SQLDataadapter to SQL Server database - 01-04-2006 , 08:23 AM






Hi,

I'm building an application, to edit data on a SQL Server database.
Database has a table Jobs with primary key (JobID) with identity seed = 1
and identity increment = 1

I'm using SQLConnection and SqlDataAdapters, DataSet, datagrid and DataViews
Dataset represents the SQL database.

When i add a record to the DataSet(Jobs), there is a Primary key generated.
So for example the datagrid on my form shows the following:


JobID JobName JobDescription
1 test1 This is the first job record
2 test2 This is the second job record
3 test3 This is the third job record


When i click add i add a new record to the dataset.
The primairy key is generated (not by my code) as JobID = 4.
But my JobID on SQL server (because i've added several records and deleted
them) is 15. When i click save my SQLDataAdapter is updating the SQL server
and adds the record (through stored procedures) without supplying a JOBID.
When the save is done i have 2 extra records. One is a record wich only
exists in the dataset with JobID = 4 and one new record from the SQL server
with JobID = 15

This is not expected behaivior... Anyone have some ideas?

Help would be greatly appriciated, thanks in advance

Rob Smeets


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.