INSERT INTO with InsertParameters: Must declare the variable XXX

INSERT INTO with InsertParameters: Must declare the variable XXX

am 23.04.2008 13:55:00 von seanmatthewwalsh

Hi

What's wrong with this code, i keep getting an error "Must declar the
variable @MyTitle"

Thanks

-----HTML CODE-----
ConnectionString="<%$ ConnectionStrings:Conn1%>"
InsertCommand="INSERT INTO Links(Title) VALUES (@MyTitle)">

Name="@MyTitle" Type="String" />


id="txtWebsiteTitle" />
runat="server" Text="Submit Link" />

-----CODEBEHIND-----
protected void btnLinkExchange_click(object sender,
System.EventArgs e)
{
SqlDataSource1.Insert();
}

RE: INSERT INTO with InsertParameters: Must declare the variable XXX

am 23.04.2008 16:14:01 von Manish

Hi,

I dont see anything wrong with the code. Please refer to the link below for
inserting rows in database using SqlDatasource control.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webco ntrols.sqldatasource.insert.aspx

Regards,
Manish
www.componentOne.com

"seanmatthewwalsh@hotmail.com" wrote:

> Hi
>
> What's wrong with this code, i keep getting an error "Must declar the
> variable @MyTitle"
>
> Thanks
>
> -----HTML CODE-----
> > ConnectionString="<%$ ConnectionStrings:Conn1%>"
> InsertCommand="INSERT INTO Links(Title) VALUES (@MyTitle)">
>
> > Name="@MyTitle" Type="String" />
>

>

> > id="txtWebsiteTitle" />
> > runat="server" Text="Submit Link" />
>
> -----CODEBEHIND-----
> protected void btnLinkExchange_click(object sender,
> System.EventArgs e)
> {
> SqlDataSource1.Insert();
> }
>