ASP.NET:Update sql table row programmatically
<p>I have a data conduit class where I want to create an update method that takes list of parameter names, their values and a stored procedure name. Up on execution, I want to update a particular row in sql db.</p>

<p>The code so far in data conduit class is:</p>

<pre><code>public class clsDataConduit
{
    SqlConnection Conn= new SqlConnection();
    SqlDataReader rdr= null;
    SqlDataAdapter dataChannel = new SqlDataAdapter();
    SqlCommandBuilder commandBuilder = new SqlCommandBuilder();
    SqlCommand cmd = null;
    List&lt;SqlParameter&gt; SQLParams = new List&lt;SqlParameter&gt;();
    DataTable queryResults = new DataTable();
    DataRow newRecord;


        public void NewRecord(string SProcName)
        {
           //works fine
        }


        public void UpdateRecord(string SProcName)
        {

        Conn= new SqlConnection(connectionString);
        //open the database
        Conn.Open();
        //initialise the command builder for this connection
        SqlCommand dataCommand = new SqlCommand(SProcName, Conn);
        //add the parameters to the command builder
        //loop through each parameter
        for (int Counter = 0; Counter &lt; SQLParams.Count; Counter += 1)
        {
            //add it to the command builder
            dataCommand.Parameters.Add(SQLParams[Counter]);
        }
        dataCommand.CommandType = CommandType.StoredProcedure;
        dataChannel = new SqlDataAdapter(SProcName, Conn);

        dataChannel.UpdateCommand = dataCommand;
        commandBuilder = new SqlCommandBuilder(dataChannel);

        dataChannel.Update(queryResults);

        ///////////////////////////////////////////////////////////
        // Method runs fine till above code, BUT I am not too sure 
        // how to write the rest of the code so that It updates a 
        // a particular row in sql
        ///////////////////////////////////////////////////////////
        //get the structure of a single record
        //newRecord = queryResults.NewRow();   //from previous method - new data


        Conn.Close();
        }
}
</code></pre>

<p>I am not too sure how can I continue further from this point. If someone can help me out please.</p>

<p>Thanks</p>
