ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Fetch Password from Database based on Login Username in ASP.Net<p>Hi @band.atul</p> <p>try the following sample</p> <p>Html</p> <pre class="brush: html">&lt;div&gt; &lt;asp:TextBox ID=&#34;txtUserName&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;asp:Button ID=&#34;btnShowPassword&#34; runat=&#34;server&#34; Text=&#34;Show Password&#34; OnClick=&#34;ShowPassword&#34; /&gt; &lt;asp:Label ID=&#34;lblPassword&#34; runat=&#34;server&#34;&gt;&lt;/asp:Label&gt; &lt;/div&gt;</pre> <p>Code</p> <pre class="brush: csharp"> protected void ShowPassword(object sende, EventArgs e) { DataTable newDT = this.GetPassword(); this.lblPassword.Text = &#34;Password:&#34; + newDT.Rows[0][&#34;Password&#34;].ToString(); } private DataTable GetPassword() { SqlConnection con = new SqlConnection(&#34;Data Source=192.168.0.1\\SQL2005;Initial Catalog=Sample;User Id=sa;Password=pass@123&#34;); SqlCommand cmd = new SqlCommand(&#34;SELECT Password FROM Table_Users WHERE UserName=@UserName&#34;, con); cmd.Parameters.Add(&#34;@UserName&#34;, this.txtUserName.Text.Trim()); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); return dt; }</pre> <p>Namespaces</p> <pre class="brush: csharp">using System; using System.Data.SqlClient; using System.Data;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/168233/Fetch-Password-from-Database-based-on-Login-Username-in-ASPNet/https://www.aspforums.net:443/Threads/168233/Fetch-Password-from-Database-based-on-Login-Username-in-ASPNet/Wed, 10 Jul 2013 05:07:01 GMT