Fill TextBox with query

burattif

Member
Joined
Aug 29, 2003
Messages
6
I want to visualize a result of a query in a TextBox.
How I make?

I Job with C# ... my (wrong) hidden code is :


.........
.........
if (!IsPostBack)
{

SqlConnection connection1 = new SqlConnection("server=Pippo;Trusted_Connection=false;database=scuole_usr;uid=redazioneusr_db;pwd=***");
try
{
connection1.Open();
SqlCommand command1 = new SqlCommand("select NumeroDoc from ComulativoDocentiIstituti", connection1);
SqlDataReader reader1 = command1.ExecuteReader();
TextBox1.DataBinding = reader1;
TextBox1.DataBind();

}
finally
{
connection1.Close();
}
......
......

The "tag", in the file .aspx, is:

<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 336px; POSITION: absolute; TOP: 203px" runat="server"></asp:TextBox>

Thanks to all!!!
Francesco
 
Back
Top