appending info to a text file
<p>I have a web site with which I am adding records to a database and The info I am also writing to a log file which is part of the website.
The info is written to the file fine...the only question I do have is how to add information with each input into the database.
As it is at the moment the information is put int the lof file but with each new insert into the database the existing record in the log file seems to be overwritten and replaced with a new insert so that there is always only one record added to the log file.
Advice perhaps...
this is the code I used in the btnClick event.</p>

<pre><code>protected void btnSubmitRating_Click1(object sender, EventArgs e)
{
    int rating = 0;
    try
    {
        if (radRating.Items[0].Selected)
        {
            rating = 1;
        }
        if (radRating.Items[1].Selected)
        {
            rating = 2;
        }
        else if (radRating.Items[2].Selected)
        {
            rating = 3;
        }
        else if (radRating.Items[3].Selected)
        {
            rating = 4;
        }
        else if (radRating.Items[4].Selected)
        {
            rating = 5;
        }
        FileStream rate = new FileStream(Server.MapPath("~/rateBooks.log"), FileMode.Open, FileAccess.ReadWrite);
        BufferedStream bs = new BufferedStream(rate);
        rate.Close();


        StreamWriter sw = new StreamWriter(Server.MapPath("~/rateBooks.log"));
        sw.WriteLine("userName " + txtUserName.Text + " " + "bookTitle " + txtBookTitle.Text + " " + "ISBN " + txtISBN.Text);
        sw.Close();


        Service s = new Service();
        s.bookRatedAdd(txtBookTitle.Text, rating, txtReview.Text, txtISBN.Text, txtUserName.Text);
        btnSubmitRating.Enabled = false;
        radRating.Enabled = false;            
    }
    catch (Exception em)
    {
        lblError.Text = em.Message; 
        //lblError.Text = "This book has already been reviewed by yourself?";
    }
}
</code></pre>

<p>Kind regards</p>
