Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
May I know what causes it?
This is the business logic:
|
|
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bryian TanPosted Feb 10, 2011, 9:15 PM
The suggestion from Suthish should work. Here is more info about it
http://forums.asp.net/t/1561630.aspx
Becky BloomwoodPosted Feb 10, 2011, 5:54 PM
//Method to DELETE Documents
public bool Delete_UploadedNewDocuments(string uploadedDocID)
{
SqlCommand cmd_UploadedDocumentsList = new SqlCommand();
cmd_UploadedDocumentsList.CommandText = "[VRM].[DELETE_UploadedNewDocuments]";
cmd_UploadedDocumentsList.CommandType = CommandType.StoredProcedure;
cmd_UploadedDocumentsList.Parameters.Clear();
SqlParameter sqlParaUDocID = new SqlParameter("@uploadedDocID", SqlDbType.VarChar, 10);//doc id
sqlParaUDocID.Value = uploadedDocID;
cmd_UploadedDocumentsList.Parameters.Add(sqlParaUDocID);
return executeNotQuery(cmd_UploadedDocumentsList);
}
And this is the stored procedure:
ALTER PROCEDURE [VRM].[DELETE_UploadedNewDocuments]
@uploadedDocID varchar(10)
AS
BEGIN
DELETE FROM VRM.UploadedDocuments WHERE uploadedDocID = @uploadedDocID
END
Thanks!
ShankeyPosted Feb 10, 2011, 8:08 AM
Please put breakpoint on line 1 and put line 2 in quick watch in VS2k5 or later and check whether it is not giving error
Suthish NairPosted Feb 10, 2011, 7:54 AM
Krishna GaradPosted Feb 10, 2011, 7:28 AM