in order to reset password you have to give email link or else you can give direct web page link. before reset password. you should take email address from the user. so you can use in where clause. see my code:
protected void save_Click(object sender, EventArgs e)
if (password.Text != "" || confirmpassword.Text != "")
if (password.Text == confirmpassword.Text)
SqlCommand cmd = new SqlCommand("update login set password='" + password.Text + "', confirmpassword='" + confirmpassword.Text + "' where email='" + Session["email"] + "'", con);
Label1.Text = "Password Reset Successfully";
HtmlMeta meta = new HtmlMeta();
meta.HttpEquiv = "Refresh";
meta.Content = "5;url=loginuser.aspx";
Label1.Text = "Password not Matched";
Label1.Text="Please Enter Password";
ask email or username. then display password reset webpage. use email or username in where clause to update password.
if you want id then use sql query like
select id from userDetails where email=session["email"];
i hope you will understand.
And you are also storing passwords in clear text, one of the most dangerous things to do. It does not matter that you are doing this as a college project. Do it right first time and you are less likely to fall into these traps when you are doing it for real. Quite frankly if you offered that as a sample of your work in a job interview you would be discounted immediately.
i am working with webgrid to show data in tabular format in edit mode. when my application is running then textboxes appear in tabular format with data. when user change existing data in textbox and submit button clicked then my server side action is getting called but no data is passing there which causes my
i am curious to know can we pass column name dynamically for where clause.
see a screen shot for searching grid. here is my link [^]
i just got a sample query. please tell me does it work?
public ActionResult Index(String ColumnName,String SearchText)
private CustomersEntities db = new CustomersEntities();
var customer = (from s in db.Customers
CustomerID = s.CustomerID,
CompanyName = s.CompanyName,
ContactName = s.ContactName,
ContactTitle = s.ContactTitle,
Address = s.Address
.Where(s => s.Field<string>(ColumnName).ToUpper().Contains(SearchText.ToUpper());
most of the time i mention column name when search with EF like this way
var query = from s in db.Customers select s;
if (ColumnName == "CompanyName")
query = query.Where(c => c.CompanyName == SearchText);
elseif (ColumnName == "ContactName")
query = query.Where(c => c.ContactName == SearchText);
see my screen shot link then you can understand what kind of UI i have to develop. user will select column name from dropdown and put value for search textbox. so when user will hint search button then search need to be done on selected column name. i may have 100 column names in dropdown and it will be huge code if i do it with if..else fashion as i mention here with sample code.
so tell me how could i reduce code for searching where column name will be passed.
...the AsEnumerable<TSource> method can be used to hide the custom methods and instead make the standard query operators available.
So, in your snippet the coder wants to make sure that the IEnumerable.Select method is called rather than any other method named "Select" on the object. This is generally to provide compile-time safety to code where ambiguities might crop up. You see this sort of sanity check a lot in code that will accept dynamics or generics.
As to your second question: always use ToArray() for immutable collections. It has less overhead and is generally more efficient if you're providing collections that won't be modified (add or remove items) later within your application.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("hsc2");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference(FileUpload1.FileName);
//...Create or overwrite the "myblob" blob with contents from a local file.
using (var memoryStream = new MemoryStream())
memoryStream.Position = 0;
StreamReader streamReader = new StreamReader(memoryStream);
//String blobText = streamReader.ReadToEnd();
DataSet ds1 = new DataSet();