Inserting from a asp:table

  • Thread starter Thread starter merrittr
  • Start date Start date
M

merrittr

I have a sqldatasource and a asp:table as below, using the
InserCommand from the sqldatasource how would I get the fields in the
table inserted ?


<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"



<asp:Table ID="Table1" runat="server" Width="411px"
BackColor="#C0C0FF" d>
<asp:TableRow runat="server">
<asp:TableCell Text="Asset_ID" runat="server"></
asp:TableCell>
<asp:TableCell runat="server">
:<asp:TextBox ID="Asset_ID" runat="server"></
asp:TextBox></asp:TableCell>
<asp:TableCell Text="Agency_ID" runat="server"></
asp:TableCell>
<asp:TableCell runat="server">
:<asp:TextBox ID="Agency_ID" runat="server"></
asp:TextBox></asp:TableCell>
</asp:TableRow>
..
..
..
</asp:Table>
 
In your CodeBehind you can write lines as below.

SqlDataSource1.InsertCommand = "Insert into ...";
SqlDataSource1.InsertParameters.Add("ParameterName", "ParameterValue");
SqlDataSource1.Insert();

Regards
JIGNESH
 
Back
Top