Note:- Here Title is the Primary Key.
if (txtUserName.Text != "")
{
SPWeb currentWeb = SPContext.Current.Web;
SPList lstLogin = currentWeb.Lists["Login"];
SPQuery sQuery = new SPQuery();
sQuery.Query = "<Where><Eq><FieldRef Name='UserName' /><Value
Type='Text'>" + txtUserName.Text.ToString().ToLower() + "</Value></Eq></Where>";
SPListItemCollection myColl = lstLogin.GetItems(sQuery);
if (myColl.Count > 0)
{
SPListItem item = myColl[0];
txtPassWord.Text = item["PassWord"].ToString();
lblMessage.Text = "Record Found " + txtUserName.Text;
}
}
No comments:
Post a Comment