G
Guest
I've found my program got exception as follows:-
----------------------------------------------
Exception: System.ArgumentException
Message: The SqlParameter with ParameterName 'XXXXX' is already contained by
another SqlParameterCollection.
Source: System.Data
at System.Data.SqlClient.SqlParameterCollection.Validate(Int32 index,
SqlParameter value)
at
System.Data.SqlClient.SqlParameterCollection.AddWithoutEvents(SqlParameter
value)
at System.Data.SqlClient.SqlParameterCollection.Add(SqlParameter value)
at System.Data.SqlClient.SqlParameterCollection.Add(Object value)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.AttachParameters(IDbCommand
command, IDataParameter[] commandParameters)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.PrepareCommand(IDbCommand
command, IDbConnection connection, IDbTransaction transaction, CommandType
commandType, String commandText, IDataParameter[] commandParameters, Boolean&
mustCloseConnection)
at
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(IDbConnection
connection, CommandType commandType, String commandText, IDataParameter[]
commandParameters)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(String
connectionString, CommandType commandType, String commandText,
IDataParameter[] commandParameters)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(String
connectionString, String spName, Object[] parameterValues)
....
----------------------------------------------
when I find out the problem I've found that my database already has that
record. So I wondor that why it does not throw exception like another
duplicate record something like ".... PK_XXXX ...." (duplication key). I've
got this exception in sometimes (the most is SqlException with violation key).
Someone may be wonder that why I do not post this to the board at GotDotNet.
Because I've already posted it and may be someone in this place can figure
out of my problem.
Thanks in advance,
Thana N.
----------------------------------------------
Exception: System.ArgumentException
Message: The SqlParameter with ParameterName 'XXXXX' is already contained by
another SqlParameterCollection.
Source: System.Data
at System.Data.SqlClient.SqlParameterCollection.Validate(Int32 index,
SqlParameter value)
at
System.Data.SqlClient.SqlParameterCollection.AddWithoutEvents(SqlParameter
value)
at System.Data.SqlClient.SqlParameterCollection.Add(SqlParameter value)
at System.Data.SqlClient.SqlParameterCollection.Add(Object value)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.AttachParameters(IDbCommand
command, IDataParameter[] commandParameters)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.PrepareCommand(IDbCommand
command, IDbConnection connection, IDbTransaction transaction, CommandType
commandType, String commandText, IDataParameter[] commandParameters, Boolean&
mustCloseConnection)
at
GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(IDbConnection
connection, CommandType commandType, String commandText, IDataParameter[]
commandParameters)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(String
connectionString, CommandType commandType, String commandText,
IDataParameter[] commandParameters)
at GotDotNet.ApplicationBlocks.Data.AdoHelper.ExecuteNonQuery(String
connectionString, String spName, Object[] parameterValues)
....
----------------------------------------------
when I find out the problem I've found that my database already has that
record. So I wondor that why it does not throw exception like another
duplicate record something like ".... PK_XXXX ...." (duplication key). I've
got this exception in sometimes (the most is SqlException with violation key).
Someone may be wonder that why I do not post this to the board at GotDotNet.
Because I've already posted it and may be someone in this place can figure
out of my problem.
Thanks in advance,
Thana N.