S
seanmatthewwalsh
Hi
What's wrong with this code, i keep getting an error "Must declar the
variable @MyTitle"
Thanks
-----HTML CODE-----
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Conn1%>"
InsertCommand="INSERT INTO Links(Title) VALUES (@MyTitle)">
<InsertParameters>
<asp:ControlParameter PropertyName="text" ControlID="txtWebsiteTitle"
Name="@MyTitle" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:TextBox text="XXXXXXXXXXXtitle from default" runat="server"
id="txtWebsiteTitle" />
<asp:Button id="btnLinkExchange" onclick="btnLinkExchange_click"
runat="server" Text="Submit Link" />
-----CODEBEHIND-----
protected void btnLinkExchange_click(object sender,
System.EventArgs e)
{
SqlDataSource1.Insert();
}
What's wrong with this code, i keep getting an error "Must declar the
variable @MyTitle"
Thanks
-----HTML CODE-----
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:Conn1%>"
InsertCommand="INSERT INTO Links(Title) VALUES (@MyTitle)">
<InsertParameters>
<asp:ControlParameter PropertyName="text" ControlID="txtWebsiteTitle"
Name="@MyTitle" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:TextBox text="XXXXXXXXXXXtitle from default" runat="server"
id="txtWebsiteTitle" />
<asp:Button id="btnLinkExchange" onclick="btnLinkExchange_click"
runat="server" Text="Submit Link" />
-----CODEBEHIND-----
protected void btnLinkExchange_click(object sender,
System.EventArgs e)
{
SqlDataSource1.Insert();
}