HighTechTalks DotNet Forums  

Troubles with updating Typed dataset bound to some controls

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Troubles with updating Typed dataset bound to some controls in the Dotnet Data Tools forum.



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

Default Troubles with updating Typed dataset bound to some controls - 10-10-2007 , 07:07 PM






Hi,

I have a typed dataset created on northwind database. It relates to a
single table, Employees.
I created the following stored procs for crud operations:

CREATE PROCEDURE [dbo].[DeleteEmployees] @EmployeeID int
AS
DELETE FROM [dbo].[Employees]
WHERE
[EmployeeID] = @EmployeeID

GO

CREATE PROCEDURE [dbo].[InsertEmployees]
@LastName nvarchar(20), @FirstName nvarchar(10), @Title nvarchar(30),
@TitleOfCourtesy nvarchar(25), @BirthDate datetime, @HireDate
datetime,
@Address nvarchar(60), @City nvarchar(15),@Region nvarchar(15),
@PostalCode nvarchar(10), @Country nvarchar(15), @HomePhone
nvarchar(24),
@Extension nvarchar(4), @Photo image, @Notes ntext,
@ReportsTo int, @PhotoPath nvarchar(255), @Modified datetime,
@EmployeeID int OUTPUT
AS

INSERT INTO [dbo].[Employees] (
[LastName], [FirstName], [Title], [TitleOfCourtesy], [BirthDate],
[HireDate], [Address], [City], [Region], [PostalCode],
[Country], [HomePhone], [Extension], [Photo], [Notes],
[ReportsTo], [PhotoPath], [Modified] )
VALUES (
@LastName, @FirstName, @Title, @TitleOfCourtesy, @BirthDate,
@HireDate, @Address, @City, @Region, @PostalCode,
@Country, @HomePhone,@Extension,@Photo,@Notes,
@ReportsTo, @PhotoPath,@Modified)

SET @EmployeeID = @@IDENTITY
GO

CREATE PROCEDURE [dbo].[SelectEmployees] @EmployeeID int = NULL
AS
IF (@EmployeeID IS NOT NULL)
BEGIN
SELECT
[EmployeeID], [LastName], [FirstName], [Title],
[TitleOfCourtesy], [BirthDate], [HireDate], [Address],
[City], [Region], [PostalCode], [Country],
[HomePhone], [Extension], [Photo], [Notes],
[ReportsTo],[PhotoPath], [Modified]
FROM
[dbo].[Employees]
WHERE
[EmployeeID] = @EmployeeID
END
ELSE
BEGIN
SELECT
[EmployeeID], [LastName], [FirstName], [Title],
[TitleOfCourtesy], [BirthDate], [HireDate], [Address],
[City], [Region], [PostalCode], [Country],
[HomePhone], [Extension], [Photo], [Notes],
[ReportsTo],[PhotoPath], [Modified]
FROM
[dbo].[Employees]
END
GO

CREATE PROCEDURE [dbo].[UpdateEmployees]
@LastName nvarchar(20), @FirstName nvarchar(10), @Title nvarchar(30),
@TitleOfCourtesy nvarchar(25), @BirthDate datetime, @HireDate
datetime,
@Address nvarchar(60), @City nvarchar(15),@Region nvarchar(15),
@PostalCode nvarchar(10), @Country nvarchar(15), @HomePhone
nvarchar(24),
@Extension nvarchar(4), @Photo image, @Notes ntext,
@ReportsTo int, @PhotoPath nvarchar(255), @Modified datetime,
@EmployeeID int
AS

UPDATE [dbo].[Employees] SET
[LastName] = @LastName, [FirstName] = @FirstName,
[Title] = @Title, [TitleOfCourtesy] = @TitleOfCourtesy,
[BirthDate] = @BirthDate, [HireDate] = @HireDate,
[Address] = @Address, [City] = @City,
[Region] = @Region, [PostalCode] = @PostalCode,
[Country] = @Country, [HomePhone] = @HomePhone,
[Extension] = @Extension, [Photo] = @Photo,
[Notes] = @Notes, [ReportsTo] = @ReportsTo,
[PhotoPath] = @PhotoPath, [Modified] = @Modified
WHERE
[EmployeeID] = @EmployeeID


The form contains a listbox bound to the typed dataset as datasource
and datamember bound to name
Also I have some edit boxes bound to first / last and few other fields

when I move the list up and down and edit some entries in the fields,
I click a button which calls MyTableAdapter.Update(MyDataSet);

The problem seems that the data is not always updated. Sometimes data
is saved except the last change I did.

What can be wrong? Is there any known problem with tableadapters and
datasets regarding data updates?

I created a simple update sequence in code, in which I create a
datatable from Tableadapter, change some fields and call Update and in
that case the updates are sent always.

Can anyone tell me what is wrong with dataset bound to form's fields?

Thank you


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 - 2009, Jelsoft Enterprises Ltd.