Groups > Asp .Net > Data Access and ObjectDataSource Control > Re: LINQ Update w/SPROC does nothing




LINQ Update w/SPROC does nothing

LINQ Update w/SPROC does nothing
Wed, 2 Apr 2008 16:35:27 +0000
Hi there, totally stumped and been looking for answers all morning.  Tried this
multiple ways but no matter what I do, nothing happens at all:

1    DataClassesDataContext myDB = new DataClassesDataContext();
2                ArgentCounter argentcounter =
myDB.ArgentCounters.SingleOrDefault(i => i.id == 1);
3                argentcounter.Blunderer = txtName.Text;
4                argentcounter.Date_Recover = calPickDay.SelectedDate;
5                myDB.ArgentCounters.Attach(argentcounter, true);
6                myDB.SubmitChanges();


 

SPROC:

1    set ANSI_NULLS ON
2    set QUOTED_IDENTIFIER ON3    GO
4    ALTER PROCEDURE [dbo].[sp_UpdateArgentCounter]
5    	@id smallint,
6    	@Blunderer varchar(50),
7    	@Date datetime
8    AS
9    	SET NOCOUNT ON;
10   update dbo.ArgentCounter
11   set Blunderer= @Blunderer, 
12   	Date_Recover = @Date
13   where id = @id
   

 

Just trying to do a simple update where ID = 1.  I set the Update properties for
my table in the DataClasses file to my SPROC rather than runime, and I don't get
any errors, and nothing updates.  Any idea what's up?  'id' is a primary key but
not identity.  I've got this code in a button click event, if that makes any
difference.  I have no problem using other SPROCs for select statments, perhaps
there is a different format for the update? --Thanks
Post Reply
Re: LINQ Update w/SPROC does nothing
Thu, 3 Apr 2008 10:33:36 +0000
DataClassesDataContext myDB = new DataClassesDataContext();
2                ArgentCounter argentcounter =
myDB.ArgentCounters.SingleOrDefault(i => i.id == 1);
3                argentcounter.Blunderer = txtName.Text;
4                argentcounter.Date_Recover = calPickDay.SelectedDate;
5               // myDB.ArgentCounters.Attach(argentcounter, true); - remove
this line
6                myDB.SubmitChanges();
Post Reply
Re: LINQ Update w/SPROC does nothing
Thu, 3 Apr 2008 12:15:37 +0000
With or without that line, nothing happens at all.  There is no error or update
to the database.
Post Reply
Re: LINQ Update w/SPROC does nothing
Thu, 3 Apr 2008 13:54:19 +0000
did you fire Update event
Post Reply
Re: LINQ Update w/SPROC does nothing
Thu, 3 Apr 2008 13:59:41 +0000
Can you please define "fire update event"?  In my dataclasses page I
defined the sproc as the custom update, but I don't have any other code for
doing an update.  Is there code for specifically firing an update event?
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact