本文介绍了asp.net中的网站设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! Helloo .. 我想将表格中的数据插入数据库。我正在使用< asp:Formparameter>插入。但我知道formparameter不支持验证。那我现在该怎么办。请帮帮我...... 这里是代码....Helloo..I want to insert data from a form to a database.I am using <asp:Formparameter> to insert. but i came to know that formparameter does not support validation.so what can i do now.Please help me out...here is the code....protected void btn_click(object sender, EventArgs e) { if (Page.IsValid) { srcusers.Insert(); confirmmsg.Text = "Data Inserted"; } else { confirmmsg.Text = "Fill carefully"; } } HTML:HTML:<asp:DetailsView ID="DetailsView1" DataSourceID="srcusers" EmptyDataText="No Records present" AllowPaging="true" runat="server" Height="50px" Width="125px"> </asp:DetailsView> <asp:SqlDataSource ID="srcusers" ConnectionString="<%$ ConnectionStrings:userdatabase %>" SelectCommand="SELECT * FROM Curr_Projects" InsertCommand="INSERT into Curr_Projects (Portcode,Portname,Proj_Id,Proj_Name,Description,Dateofissue,TargetToachieve,Estimatedcost) VALUES (@Portcode,@Portname,@Proj_Id,@Proj_Name,@Description,@Dateofissue,@TargetToachieve,@Estimatedcost)" runat="server"> <InsertParameters> <asp:FormParameter Name="portcode" FormField="tpc" /> <asp:FormParameter Name="portname" FormField="tpn" /> <asp:FormParameter Name="Proj_id" FormField="tprojno"/> <asp:FormParameter Name="Proj_Name" FormField="tprname" /> <asp:FormParameter Name="Description" FormField="tprdesc" /> <asp:FormParameter Name="dateofissue" FormField="tdateiss" Type="DateTime" /> <asp:FormParameter Name="TargetToachieve" FormField="ttg" /> <asp:FormParameter Name="Estimatedcost" FormField="test" /> </InsertParameters> </asp:SqlDataSource>推荐答案 这篇关于asp.net中的网站设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 22:59