An SqlCeParameter with ParameterName '25' is not contained by this SqlCeParameterCollection.
Description: An
unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: An SqlCeParameter with ParameterName '25' is not contained by this SqlCeParameterCollection.
Source Error:
Line 87:
Line 88: var db = Database.Open("Documents");
Line 89: db.Execute(@"INSERT INTO Diploma_Leaving (UserId, LC_no, Book_no, Register_no, Religion, Caste, Sub_caste, Nationality, Birth_place,District, Birth_date, Prev_school_college, Admission_date, Conduct, Progress, Leaving_date, Studying_class, Studying_month, Studying_year, Reason,Remark, Division, Exam, Exam_year, Seat_no, Enrollment) Line 90: VALUES (@0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13,@14,@15,@16,@17,@18,@19,@20,@21,@22,@23,@24,@25)",UserId, LC_no, Book_no, Register_no, Caste,Sub_caste, Nationality, Birth_place, District,DOB,Prev_school_college,Admission_date,Conduct,Progress,Leaving_date, Studying_class, Studying_month, Studying_year,Reason,Remark,Division,Exam,Exam_year,Seat_no,Enrollment);
Line 91: }
Stack Trace:
[IndexOutOfRangeException: An SqlCeParameter with ParameterName '25' is not contained by this SqlCeParameterCollection.]
System.Data.SqlServerCe.SqlCeParameterCollection.ThrowParamterNotFoundException(String parameterName) +188
System.Data.SqlServerCe.SqlCeParameterCollection.RangeCheck(String parameterName, SqlCeParameter& param) +122
System.Data.SqlServerCe.SqlCeParameterCollection.get_Item(String parameterName) +19
System.Data.SqlServerCe.SqlCeCommand.CreateParameterAccessor(MetaData[] metadata) +149
System.Data.SqlServerCe.SqlCeCommand.CreateDataBindings() +103
System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() +700
System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) +542
System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() +21
WebMatrix.Data.Database.Execute(String commandText, Object[] args) +116
ASP.<>c__DisplayClass28.<Insert_Diploma_Leaving>b__27(TextWriter __razor_helper_writer) in c:\Users\XBlaZE\Documents\My Web Sites\HomeManagementSystem\App_Code\Helper.cshtml:89
System.Web.WebPages.HelperResult.WriteTo(TextWriter writer) +10
System.Web.WebPages.WebPageBase.Write(HelperResult result) +71
ASP._Page_Testing_Page2_cshtml.Execute() in c:\Users\XBlaZE\Documents\My Web Sites\HomeManagementSystem\Testing\Page2.cshtml:40
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197
System.Web.WebPages.WebPage.ExecutePageHierarchy(IEnumerable`1 executors) +69
System.Web.WebPages.WebPage.ExecutePageHierarchy() +151
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +76
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext) +114
Member
2 Points
28 Posts
SqlCeParameter Error!
Aug 09, 2013 04:00 PM|Red77|LINK
Whenever i try to post values , i get this error!
An SqlCeParameter with ParameterName '25' is not contained by this SqlCeParameterCollection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IndexOutOfRangeException: An SqlCeParameter with ParameterName '25' is not contained by this SqlCeParameterCollection.
Source Error:
Line 87: Line 88: var db = Database.Open("Documents"); Line 89: db.Execute(@"INSERT INTO Diploma_Leaving (UserId, LC_no, Book_no, Register_no, Religion, Caste, Sub_caste, Nationality, Birth_place,District, Birth_date, Prev_school_college, Admission_date, Conduct, Progress, Leaving_date, Studying_class, Studying_month, Studying_year, Reason,Remark, Division, Exam, Exam_year, Seat_no, Enrollment) Line 90: VALUES (@0,@1,@2,@3,@4,@5,@6,@7,@8,@9,@10,@11,@12,@13,@14,@15,@16,@17,@18,@19,@20,@21,@22,@23,@24,@25)",UserId, LC_no, Book_no, Register_no, Caste,Sub_caste, Nationality, Birth_place, District,DOB,Prev_school_college,Admission_date,Conduct,Progress,Leaving_date, Studying_class, Studying_month, Studying_year,Reason,Remark,Division,Exam,Exam_year,Seat_no,Enrollment); Line 91: }
Stack Trace:
All-Star
114593 Points
18503 Posts
MVP
Re: SqlCeParameter Error!
Aug 09, 2013 04:10 PM|Rion Williams|LINK
It's likely that you could be missing a parameter (which could result in your query being off).
After looking at it a bit more, it appears that you forgot to include the 'Religion' parameter :
Member
2 Points
28 Posts
Re: SqlCeParameter Error!
Aug 09, 2013 04:20 PM|Red77|LINK
Dam............ it was so easy one! thanx for the answer!