I am trying to insert data from a web form to a SQL Database. I am receiving the following error: {"String was not recognized as a valid Boolean."} I am also receiving a similar error for text boxes that have dates.
Below is the code that I am using:
<asp:SqlDataSource
id="SqlDataSource1"
runat="server"
connectionstring="<%$ ConnectionStrings:ConnMktProjReq %>"
selectcommand="SELECT LoanRepName,Branch,CurrentDate,ReqDueDate,ProofByEmail,ProofByEmail,FaxNumber,ProjectExplanation,PrintQuantity,PDFDisc,PDFEmail,LoanRepEmail FROM MktProjReq"
insertcommand="INSERT INTO MktProjReq(LoanRepName, Branch, CurrentDate, ReqDueDate, ProofByEmail, ProofByEmail, FaxNumber, ProjectExplanation, PrintQuantity, PDFDisc, PDFEmail, LoanRepEmail) VALUES (@.RepName, @.BranchName, @.Date, @.DueDate, @.ByEmail, @.ByFax, @.Fax, @.ProjExp, @.PrintQty, @.Disc, @.Email, @.RepEmail)">
<InsertParameters>
<asp:FormParameterName="RepName"FormField="LoanRepNameBox"/>
<asp:FormParameterName="BranchName"FormField="BranchList"/>
<asp:FormParameterName="Date"FormField="CurrentDateBox"Type="DateTime"/>
<asp:FormParameterName="DueDate"FormField="ReqDueDateBox"Type="DateTime"/>
<asp:FormParameterName="ByEmail"FormField="ProofByEmailCheckbox"Type="boolean"/>
<asp:FormParameterName="ByFax"FormField="ProofByFaxCheckbox"Type="boolean"/>
<asp:FormParameterName="Fax"FormField="FaxNumberBox"/>
<asp:FormParameterName="ProjExp"FormField="ProjectExplanationBox"/>
<asp:FormParameterName="PrintQty"FormField="PrintQuantityBox"/>
<asp:FormParameterName="Disc"FormField="PDFByDiscCheckbox"Type="boolean"/>
<asp:FormParameterName="Email"FormField="PDFByFaxCheckbox"Type="boolean"/><asp:FormParameterName="RepEmail"FormField="LoanRepEmailBox"/>
</InsertParameters>
</asp:SqlDataSource>
protectedvoid Button1_Click(object sender,EventArgs e){
SqlDataSource1.Insert();
}
I have been searching forums for parsing data, but I haven't found anything that works. Can anyone provide guidance.
Thank you,
Paul
What about remove (cross out in the following) the Type="boolean" for these formfields:
<asp:FormParameterName="ByEmail"FormField="ProofByEmailCheckbox"Type="boolean" />
<asp:FormParameterName="ByFax"FormField="ProofByFaxCheckbox" Type="boolean" />
<asp:FormParameterName="Disc"FormField="PDFByDiscCheckbox" Type="boolean" />
<asp:FormParameterName="Email"FormField="PDFByFaxCheckbox" Type="boolean" />
Thank you, that ended the exception errors.
Paul
No comments:
Post a Comment