First of all please clear your question, need some more specification or enhancement about what you want ant what you are trying already..
as per my understanding about your question i replied it...
1) first of designed your asp.net page with number of textboxes you need to show the data like if you need to show 1 columns data then create or designed 1 textboxes with appropriate id or name...
2) in code behinde page you need to write the code for connecting to database and getting data from that database...
3) after getting data from database you need to bind that data with your text box..
4) as you mention that you need to update the data so you need to put one button for handaling updatation of database data...
i think you can perform 1st step with your own way.. and i here give a 1 column data binding example with my own textbox id, what you need is you need to modify my simple code in your own way and make appropriate changes for your solution...
for your database operation you can use code like this..
protected void CreateConnection()
{
try
{
if (SqlCon == null)
{
string ConnectionString = "YOUR CONNECTION STRING";
SqlCon = new SqlConnection(ConnectionString);
}
if (Da == null)
{
Da = new SqlDataAdapter();
}
}
catch (Exception exe)
{
throw exe;
}
}
protected void OpenConnection()
{
if (SqlCon != null && SqlCon.State != ConnectionState.Open)
{
SqlCon.Open();
}
}
protected void CloseConnection()
{
if (SqlCon.State != ConnectionState.Closed)
SqlCon.Close();
}
for getting resulted data you can use like this..
CreateConnection();
DataTable resultTable = new DataTable("YOURRESULTEDDATATABLENAME");
OpenConnection();
Da.SelectCommand = new SqlCommand();
Da.SelectCommand.Connection = SqlCon;
Da.SelectCommand.CommandType = CommandType.Text;
Da.SelectCommand.CommandText = "YOUR SELECT QUERY THAT WILL RETURN YOUR COLUMNS DATA";
Da.Fill(resultTable);
if (resultTable.Rows.Count > 0)
{
TextBox1.Text = resultTable.Rows[0]["YOUR COLUMN NAME"].ToString();
}
CloseConnection();
For update button query you need use something like this...
CreateConnection();
OpenConnection();
Da.UpdateCommand = new SqlCommand();
Da.UpdateCommand.Connection = SqlCon;
Da.UpdateCommand.CommandText = "YOUR UPDATE QUERY QUERY";
Da.UpdateCommand.ExecuteNonQuery();
CloseConnection();
i hope this will help you or further detail you can see this link..
Databinding[
^]