Karthikeyan M Karthikeyan M - 2 months ago 16
SQL Question

Grid View Insert Query Error

i got grid view in asp.net,

while i am trying to create

protected void add_button(object sender, EventArgs e)
{
SqlDataSource1.InsertParameters["Name"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("Txt1")).Text;

SqlDataSource1.InsertParameters["CountryNotes"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("Txt2")).Text;

SqlDataSource1.Insert();
}


while i build the solution i got the error as below


"'TextBox' is an ambiguous reference between
'System.Web.UI.WebControls.TextBox' and 'System.Windows.Forms.TextBox
"


how to resolve this

Answer

System.Windows.Forms is used in Windows-based applications. Try removing

using System.Windows.Forms;