title: Using a database in .NET
body: <p>UPDATED QUESTION:</p>
  
  <p>Ok, I am going to simplify my question since I don't really know how to answer your questions.</p>
  
  <p>Say I create a new Windows Forms Application,
  then Project->Add New Item->Local Database.</p>
  
  <p>Then in Database Explorer I create a table ("testtable") and give it an "ID" column and "VALUE" column.</p>
  
  <p>Can you provide me with the steps to simply add a row to the database from the code?</p>
  
  <p>OLD QUESTION:</p>
  
  <blockquote>
    <p>I have been trying to do something
    that I think would be really easy but
    have never used C# before and am
    having trouble with the details. I
    simple want to use a sql database with
    Visual C# Express 2008.</p>
    
    <p>For testing purposes I have a datagrid
    on my form that can reflect changes to
    the db.</p>
    
    <p>If i use this:</p>
  
  <pre><code>codesTableAdapter.Fill(dataSet1.codes);
  </code></pre>
    
    <p>The datagrid(dataset) will fill with
    the info from the sql database.</p>
    
    <p>If i then do something like this:</p>
  
  <pre><code>codesTableAdapter.InsertQuery(txtCode.Text,txtName.Text);
  codesTableAdapter.Fill(dataSet1.codes);
  codesTableAdapter.Update(dataSet1);
  dataSet1.AcceptChanges();
  </code></pre>
    
    <p>The datagrid reflects the changes but
    if close the program and go to the
    database the changes are not there.
    When I open the program again the
    changes are not there.</p>
    
    <p>I have a feeling this isn't too clear
    as my understanding here is very low
    so please let me know what other info
    is needed.</p>
  </blockquote>