This question is locked. New answers and comments are not allowed.
I am beginner and developing a silverlight navigation application with SQL Server 2008.
I have a 'Registration' table where initially users request for membership are stored. The admins will verify them and later the particular user details are moved to 'Members' table from 'Registration'. Moreover when the term/period of membership comes to end the same details are finally moved to 'PastMembers' table from 'Members' table.
Now what I wanted is that before the registration details are submitted it should be checked in all three tables(Registration,Members,PastMembers) for username specified and if any record is found it should restrict user by submitting details to avoid duplicate userids.
I searched and tried to count the rows but even though I have a record with same userid I get count=0
Please let me know if any other better option or any rectification in this logic (please be a more brief since I am a beginner)
Checking in just first table
Code in submit button click handler
Function in myDomainService.cs
consider sample fields in tables as:
Tables: Registration,Members,PastMembers having
userid,
fullname,
contact
I have a 'Registration' table where initially users request for membership are stored. The admins will verify them and later the particular user details are moved to 'Members' table from 'Registration'. Moreover when the term/period of membership comes to end the same details are finally moved to 'PastMembers' table from 'Members' table.
Now what I wanted is that before the registration details are submitted it should be checked in all three tables(Registration,Members,PastMembers) for username specified and if any record is found it should restrict user by submitting details to avoid duplicate userids.
I searched and tried to count the rows but even though I have a record with same userid I get count=0
Please let me know if any other better option or any rectification in this logic (please be a more brief since I am a beginner)
Checking in just first table
Code in submit button click handler
myDomainContext objctx1 =
new
myDomainContext();
var query1 = objctx1.GetregistrationsByIDQuery(userid_txtbx.Text);
objctx1.Load(query1);
var count = (from c
in
objctx1.registrations where c.userid == userid_txtbx.Text select c).Count();
// To see how many rows there
MessageBox.Show(count.ToString());
// Code for restricting details to be submitted
Function in myDomainService.cs
// Query to get usernames from registrations table
public
IQueryable<registration> GetregistrationsByID(
string
id)
{
return
this
.ObjectContext.registrations.Where(s => s.userid == id);
}
consider sample fields in tables as:
Tables: Registration,Members,PastMembers having
userid,
fullname,
contact