title: Multiple databases on one SQL server with same table names. Two Linq to SQL Classes - Ambiguity error
body: <p>I'm trying to write a tool which will update a users account credentials across several databases. Each of these databases are basically supporting a different version of the same application so each database has the same table names. I'm only interested in one table called opususer on each of these databases.</p>
  
  <p>I was able to create the first Linq to SQL class and using a checkbox list I create a collection of selected items and send it to a method which loops through and should update the user credentials. This works fine when I have one DataContext, but when I add another Linq to SQL class and try to recreate the same thing except on a different database I receive several Ambiguity errors and "The member is defined more than once" errors.</p>
  
  <p>I don't understand as the LinqToSQL class is pointing to a completely different database although the table name is the same, but why should that matter as the datacontext should keep it separate no?</p>
  
  <p>I've tried using one DataContext and also adding an alias, but I'm not sure if this can be done. I'm new to ASP.NET...</p>
  
  <pre><code>            if (DatabaseName == "clincomm_243x")
              {
                  using (UserAccountDataContext Data = new UserAccountDataContext()) // database clincomm_243x
                  {
                      string UserName = TextBoxUserName.Text.ToUpper();
  
                      opususer CheckUser = Data.opususers
                          .SingleOrDefault(opususer =&gt; opususer.username == UserName &amp;&amp; opususer.active == true);
                      if (CheckUser == null || TextBoxUserName.Text.Length ==0)
                      {
                          TextBoxResult.Visible = true;
                          TextBoxResult.Text = "Username " + UserName + " does not exist. Please check and try again!";
                      }
                      else
                      {
                          TextBoxResult.Text = "";
                          TextBoxResult.Text = "User " + UserName + " has been found.";
                          TextBoxResult.Visible = true;
                          TextBoxResult.Visible = true;
                          TextBoxResult.Text += "\nAttempting to update user account details.....\n";
  
                          // Set the new values for the record returned
                          CheckUser.password = "03ac674216f3e15c761ee1a5e255f067953623c8b388b4459e13f978d7c846f4";
                          CheckUser.hashtype_code = "SHA-256";
                          CheckUser.unsuccessfullogons = 0;
                          CheckUser.active = true;
                          DateTime newPasswordExpiryDate = DateTime.Now.Date.AddYears(10);
                          CheckUser.passwordexpirationdate = newPasswordExpiryDate;
                          Data.SubmitChanges();
  
                          TextBoxResult.Text += "\nUser Account " + UserName + " has been successfully updated\n";
                          TextBoxResult.Text += "\nPassword has now been set to 1234 and will not expire until " + newPasswordExpiryDate;
                      }
                  }
              }
  </code></pre>