newbie inserting record question

M

merrittr

so I am trying to insert asp:textbox in a asp:table how do I use the
sqldatasource insertCommand to get this don. I tried this in the code
behind with no luck

protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource1.Insert();
}:



<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$
ConnectionStrings:InventoryConnectionString %>"
InsertCommand="INSERT INTO [Assets] ([Agency_ID], [Asset_Tag],
[Serial_Number], [Type], [SubType], [Mfg], [Model], [Description],
[Purchase_Date], [Purchase_Cost], [Acquisition_Type], [Disposal_Date],
[Disposal_Reason], [CPU], [MIPS_or_Mhz], [Capacity], [Asset_ID],
[Warranty_End_Date], [Maintenance_End_Date], [Maintenance_Cost],
[Asset_Name], [OS_Version], [Org], [Physical_Address], [City],
[Notes]) VALUES (@Agency_ID, @Asset_Tag, @Serial_Number, @Type,
@SubType, @Mfg, @Model, @Description, @Purchase_Date, @Purchase_Cost,
@Acquisition_Type, @Disposal_Date, @Disposal_Reason, @CPU,
@MIPS_or_Mhz, @Capacity, @Asset_ID, @Warranty_End_Date,
@Maintenance_End_Date, @Maintenance_Cost, @Asset_Name, @OS_Version,
@Org, @Physical_Address, @City, @Notes)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [Assets]"
<InsertParameters>
<asp:parameter Name="original_Asset_Tag"
Type="String" />
<asp:parameter Name="original_Agency_ID" Type="Int32" / <asp:parameter Name="original_Serial_Number"
Type="String" />
<asp:parameter Name="original_Type" Type="String" />



<asp:Table ID="Table2" runat="server" AccessKey='<%# Bind("Asset_Tag")
%>'
BackColor="#C0C0FF" Enabled='<%# Eval("Agency_ID") %>'
Width="411px" Visible="true" >
<asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell ID="TableCell1" runat="server"
Text="Asset_ID"></asp:TableCell>
<asp:TableCell ID="TableCell2" runat="server">
:<asp:TextBox ID="TextBox1" runat="server"
Text='<%# Eval("Asset_ID") %>'></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell3" runat="server"
Text="Agency_ID" ></asp:TableCell>
<asp:TableCell ID="TableCell4" runat="server">
:<asp:TextBox ID="TextBox2" runat="server"
Text='<%# Eval("Agency_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow2" runat="server">
<asp:TableCell ID="TableCell5" runat="server"
Text="Asset_Tag"></asp:TableCell>
<asp:TableCell ID="TableCell6" runat="server">
:<asp:TextBox ID="TextBox3" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell7" runat="server"
Text="Serial_Number"></asp:TableCell>
<asp:TableCell ID="TableCell8" runat="server">
:<asp:TextBox ID="TextBox4" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow3" runat="server">
<asp:TableCell ID="TableCell9" runat="server"
Text="Type"></asp:TableCell>
<asp:TableCell ID="TableCell10" runat="server">
:<asp:TextBox ID="TextBox5" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell11" runat="server"
Text="SubType"></asp:TableCell>
<asp:TableCell ID="TableCell12" runat="server">
:<asp:TextBox ID="TextBox6" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow4" runat="server">
<asp:TableCell ID="TableCell13" runat="server"
Text="Mfg"></asp:TableCell>
<asp:TableCell ID="TableCell14" runat="server">
:<asp:TextBox ID="TextBox7" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell15" runat="server"
Text="Model"></asp:TableCell>
<asp:TableCell ID="TableCell16" runat="server">
:<asp:TextBox ID="TextBox8" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow5" runat="server">
<asp:TableCell ID="TableCell17" runat="server"
Text="Description"></asp:TableCell>
<asp:TableCell ID="TableCell18" runat="server">
:<asp:TextBox ID="TextBox9" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell19" runat="server"
Text="Purchase_Date"></asp:TableCell>
<asp:TableCell ID="TableCell20" runat="server">
:<asp:TextBox ID="TextBox10" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow6" runat="server">
<asp:TableCell ID="TableCell21" runat="server"
Text="Purchase_Cost"></asp:TableCell>
<asp:TableCell ID="TableCell22" runat="server">
:<asp:TextBox ID="TextBox11" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell23" runat="server"
Text="Acquisition_Type"></asp:TableCell>
<asp:TableCell ID="TableCell24" runat="server">
:<asp:TextBox ID="TextBox12" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow7" runat="server">
<asp:TableCell ID="TableCell25" runat="server"
Text="Disposal_Date"></asp:TableCell>
<asp:TableCell ID="TableCell26" runat="server">
:<asp:TextBox ID="TextBox13" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
<asp:TableCell ID="TableCell27" runat="server"
Text="Disposal_Reason"></asp:TableCell>
<asp:TableCell ID="TableCell28" runat="server">
:<asp:TextBox ID="TextBox14" runat="server"
Text='<%# Eval("Asset_ID") %>' ></asp:TextBox>
</asp:TableCell>
</asp:TableRow>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top