protected void btn_click(object sender, EventArgs e) { if (Page.IsValid) { srcusers.Insert(); confirmmsg.Text = "Data Inserted"; } else { confirmmsg.Text = "Fill carefully"; } }
<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>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)