Joan Hache

Joan Hache

  • NA
  • 5
  • 0

Error on class file

Jun 17 2008 9:52 PM

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:

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

 

 


Answers (4)