Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         -Dman100- 
                                        Posting Yak  Master 
                                         
                                        
                                        210 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2007-06-21 : 10:57:15
                                            
  | 
                                             
                                            
                                            | I have a datalist and I have successfully gotten the cancel, select and edit commands working, but I'm stuck with the update command.Here is the code: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.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;public partial class WebForm1 : System.Web.UI.Page{    string strConnString = ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString;    protected void Page_Load(object sender, EventArgs e)    {        if (!Page.IsPostBack)        {            BindList();        }    }    protected void BindList()    {        SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Customers", strConnString);        DataSet dSet = new DataSet();        adapter.Fill(dSet, "customers");        DataList1.DataSource = dSet.Tables["customers"];        DataList1.DataBind();    }    protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)    {        BindList();    }    protected void DataList1_CancelCommand(object source, DataListCommandEventArgs e)    {        DataList1.EditItemIndex = -1;        BindList();    }    protected void DataList1_EditCommand(object source, DataListCommandEventArgs e)    {        DataList1.EditItemIndex = e.Item.ItemIndex;        BindList();    }    protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)    {        string contactName = ((TextBox)(e.Item.FindControl("TextBox1"))).Text;        BindList();    }}I'm stuck on the DataList1_UpdateCommand method.  I have the select, edit and cancel commands working.  I need to update the row of the dataset to the value of the textbox, which I have set to contactName.  I think I need to use DataRow?  But, everything I've tried hasn't worked.  protected void DataList1_UpdateCommand(object source, DataListCommandEventArgs e)    {        string contactName = ((TextBox)(e.Item.FindControl("TextBox1"))).Text;        BindList();       DataSet dSet = new dSet();       DataRow dr = new DataRow()    }I'm not sure what method I need to call from the DataRow object to update the row.  Can anyone help? | 
                                             
                                         
                                     | 
                             
       
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |   
     
     
            
              
	     |  
		
			
     
          
		 |