Hello there:
I've just wrote a class file and it gives me the error: "The name 'campo' does not exists in the current content"
Can somebody give a hand and tell me how can I correct this problem, here is the class file:
PowerShell
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.Adapters;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class TipoNegocioSQL : System.Web.UI.Page
{
protected void Page_Load(Object sender, EventArgs e)
{
string Conexion = "server=server;Integrated Security=True;database=mydatabase;";
SqlConnection cn = new
SqlConnection(Conexion);
cn.Open();System.Data.SqlClient.SqlCommand cmd = new
System.Data.SqlClient.SqlCommand();
cmd.Connection = cn;
cmd.CommandText = "SELECT identificacion from mytable";
SqlDataReader dr;
dr = cmd.ExecuteReader();
while ( dr.Read() )
{
campo.Text += dr["identification"];
}
}
}
Thank you very much
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Jun 17, 2008, 8:50 PM EDT
Joan Hache3 pointsPosted Jun 18, 2008, 5:47 AM EDT
James, I'm using:
<body>
<form method="post" runat="server" id="form1">
<asp: Hyperlink id = "campo" runat="server"/>
</form>
</body>
In a aspx file which inherits the class I wrote
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Jun 18, 2008, 6:16 AM EDT
<asp: Hyperlink id = "campo" runat="server"/>
modified code :
<asp:HyperLink ID="campo" runat="server"></asp:HyperLink>
Joan Hache3 pointsPosted Jun 18, 2008, 6:32 AM EDT