hi
im having problem in retreiving data in text box in C# web form.i have a combobox and a textbox.i have successfully populated combobox with data from SQL table.there are 2 tables namely employee and worker.combobox is populated with employeee data and when i select an employee it shows relevant info. in text box from the worker table.this is the point where imhaving problem.
Kindly help me.

Ok use this code
using System;
using System.Data;
using System.Data.SqlClient;
using System.Windows.Forms;

onn.Open();
// The command settings
SqlCommand oCommand = new SqlCommand("Select * From Employee",oConn);
SqlDataAdapter oAdapter = new SqlDataAdapter(oCommand);
/* we use here data table rather than a data source because
we want just to bind a field to our textbox*/
DataTable oTable = new DataTable();
//Fill data into the data table
oAdapter.Fill(oTable);
/*We don't need the connection new as we consume data from the on memory
* cached data table so we close the connection*/
oConn.Close();
/* Assuming that we need to bind textBox1 to the FirstName Field of
* the employee table*/
textBox1.DataBindings.Add("Text", oTable, "FirstName");

But what to do in C# web forms?Actually im working with web form so kindly help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.