I am doing my project using LINQ to SQL technology for the database part. I wrote the coding for inserting a new record into the table. The coding was ok. Its working 100%. But after inserting the data into the table when I run next time in the Visual studio 2008 I cound'nt get the previously inserted data. Which means only in that instance I register, I was able to get the inserted data.
Also there is another problem. I have the Users.mdf file. When I open it to see the inserted records its not there. If you want to see the coding, here is it.
try
{
UsersDBDataContext context = new UsersDBDataContext();
var usersData =
from Usr in context.Users
where Usr.UserName == txtSignUpUserName.Text
select new { Usr.UserName };
if (usersData.Count() == 0)
{
User newUser = new User
{
RealName = txtRName.Text,
UserName = txtSignUpUserName.Text,
Password = pwbSignUpPassword.Password,
Country = ComCountry.Text,
};
context.Users.InsertOnSubmit(newUser);
context.SubmitChanges();
}
else
MessageBox.Show("User name already exists");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Can any body help me with this???????