Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:47:13+00:00 2026-06-09T07:47:13+00:00

i m writing the code: string query = Select * from AdminLogin where username=’

  • 0

i m writing the code:

string query = "Select * from AdminLogin where username='" + name + 
               "' and password='" +   password + "'";

DataSet ds = BusinessLogic.returnDataSet(query);
foreach (DataRow dr in ds.Tables[0].Rows)
{
    if (dr[0].ToString() == name && dr[1].ToString() == password)
    {
      Response.Redirect("~/Home.aspx");
    }
    else
    {
      //Here I want to write the code that will open a message box 
      //that will tell to user that username and password does not match.
     }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:47:14+00:00Added an answer on June 9, 2026 at 7:47 am

    By message box I’m assuming you mean a javascript alert. I’m not a big fan of posting back with javascript functions. I think its messy, and that javascript should only be used when dealing with client-side actions.

    I would actually recommend to use a placeholder and a literal control for this. You could have the following in your webform:

    <asp:placeholder id="phLoginFailed" runat="server" visible="false">
         <div class="loginfailed">
            Login failed
         </div>
    </asp:placeholder>
    

    This placeholder could be styled like a popup, or displayed within your page using CSS.

    Then change your C# to:

    else
    {
        phLoginFailed.Visible = true;
    }
    

    Also, its worth mentioning, your SQL query is prone to SQL Injection. You should use parameterised queries.

    And you should encrypt passwords when storing them in the database for security purposes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a lexer in haskell. Here's the code: lexer :: String -> [Token]
I am writing code to clone object but have no cue from Hobo documentation.
I am writing an SQL query as a Javascript string like that: SQLdetail =
I'm having some trouble writing a query using variables. Here's my code Dim bondnumber
I am trying to writing code so that my android application can query a
I'm writing method wrapping db SELECT statement, that receives SQL query and runs it.
I am writing some code to type strings using the Robot class. Everything is
I'm referring to the syntax for writing strings in code, including multiline strings and
I am writing the following code to find out the required strings are present
When writing code, I often place debug messages in the code. The debug messages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.