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:
Code |
Code |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Krishna GaradRank #191 · 12.8K reputationPosted Feb 10, 2011, 2:28 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Feb 10, 2011, 2:54 AM EST
ShankeyRank #972 · 2.1K reputationPosted Feb 10, 2011, 3:08 AM EST
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
Becky Bloomwood110 reputationPosted Feb 10, 2011, 12:54 PM EST
//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!
Bryian TanRank #396 · 6.3K reputationPosted Feb 10, 2011, 4:15 PM EST
The suggestion from Suthish should work. Here is more info about it
http://forums.asp.net/t/1561630.aspx