title: adding new user to sql using LINQ
body: <p>I am trying Linq to SQL to access my sql server.  I have a user table which contains uid, username &amp; password for fields.  I created linq to sql class for my dbcontext.</p>
  
  <p>i am able to connect to my site using the login screen in my login.aspx.cs:</p>
  
  <pre><code> protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
          {
              bool authenticated = false;
              TrackToolDataContext data = new TrackToolDataContext();
              authenticated = IsValidUser(Login1.UserName, Login1.Password);
              e.Authenticated = authenticated;
  
              if (e.Authenticated == true)
              {
                  Session["username"] = Login1.UserName;
                  Response.Redirect("Welcome.aspx");
              }
          }
  
          private bool IsValidUser(string un, string pw)
          {
              TrackToolDataContext data = new TrackToolDataContext();
              var userResults = from u in data.UserDetails
                                where u.username == un
                                &amp;&amp; u.password == pw
                                select u;
  
              return Enumerable.Count(userResults) &gt; 0;
  
          }
  </code></pre>
  
  <p>but when i try to create a new user screen, i am having difficulty.
  I created regular username, password fields in User class mimicking my tables, and in my new user page, i tried to get all the fields from the User class and tried to linq it to sql, i am getting this error:<img src="https://i.stack.imgur.com/1JuQ4.png" alt="enter image description here"></p>
  
  <p>Here is my code for creating new user:</p>
  
  <pre><code> protected void CreateUser_Click(object sender, EventArgs e)
      {
          // CreateUser(TextBox1.Text, TextBox2.Text);
          User u = new User();
          u.username = TextBox1.Text;
          u.password = TextBox2.Text;
  
          TrackToolDataContext data = new TrackToolDataContext();
          data.UserDetails.InsertOnSubmit(u);
          data.SubmitChanges();
      }
  </code></pre>