Im stuck....

Im stuck....

Old forum URL: forums.lhotka.net/forums/t/7519.aspx


gbk posted on Thursday, August 27, 2009

Hey there

CSLA is very new to me, and im only starting to use it recently. So the problem that i have might be a piece of cake for the rest of you.

Im trying to update but cant seem to get it right. Im using connectionManager and stored procs to manipulate data in tables. I got it right to retrieve the data but when i try to update it using the myAcc.Save() method then it gives me an error that says.

DataPortal.Update failed (System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.Accounts' with unique index 'IX_Accounts_AccountNo'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at AccSageProject.Library.Account.DataPortal_Insert() in C:\Users\TEMP\Documents\Celeste\AccSageV1.4.2\WindowsApplication1\Account.vb:line 261
at dm(Object , Object[] )
at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters) in C:\Visual Studio Projects\CSLA\Source\cslacs\Csla\Reflection\MethodCaller.cs:line 332)

Please HELP... or provide any other way to help me update

Thanks in advance

Copyright (c) Marimer LLC