Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 10 Oct 2007 16:07:04 -0700,    group: microsoft.public.dotnet.datatools        back       


Troubles with updating Typed dataset bound to some controls   
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
date: Wed, 10 Oct 2007 16:07:04 -0700   author:   bz

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us