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

  • SEARCH
  • Home
  • 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 7631523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:22:31+00:00 2026-05-31T06:22:31+00:00

My code : var db = Database.Open(dbase); var term = Request.Form[username] + %; var

  • 0

My code :

var db = Database.Open("dbase");
var term = Request.Form["username"] + "%";
var sql = "SELECT * from Users where Username LIKE @0";
var result = db.Query(sql, term);
var data = result.Select(p => new{label = p.username});
Json.Write(data, Response.Output);

And the form :

<script type="text/javascript">
        $(function(){
            $('#username').autocomplete({source:'getProducts'});
        });
    </script>
    </head>
    <body>
        <form method="post">
            <label for="username">Enter Username: </label>
            <input type="text" name="username" id="username" />
        </form>

The problem : This process is ran every time a user types a character into a text box. No matter what character is typed, every single username in the database is returned. I assume the problem lies in my SQL query ?

Can anyone help me with this ?

  • 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-05-31T06:22:33+00:00Added an answer on May 31, 2026 at 6:22 am

    Use Request.QueryString["term"] instead of Request.Form["username"].

    This is based on the documentation at http://jqueryui.com/demos/autocomplete/. Look for the quoted string "term" on that page.

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

Sidebar

Related Questions

My code : var db = Database.Open(dbase); var result = db.Query(SELECT event_id, description, title,
Code: var result = db.rows.Take(30).ToList().Select(a => AMethod(a)); db.rows.Take(30) is Linq-To-SQL I am using ToList()
With this code: var db = google.gears.factory.create('beta.database'); db.open('cominar'); db.execute('CREATE TABLE IF NOT EXISTS Ajax
How do you add named SQL Parameters in WebPages Framework? var db = Database.Open(database);
I have this simple example code: var request = mozIndexedDB.open('MyTestDatabase'); request.onsuccess = function(event){ var
I have the following code: @helper RetrievePhotoWithName(int userid) { var database = Database.Open(SC); var
enter code hereIn my SQL Server database I have my address information for the
I am trying to get the data from database by using the below code.....
See code: var file1 = 50.xsl; var file2 = 30.doc; getFileExtension(file1); //returns xsl getFileExtension(file2);
The code: var foo = /\</; When I go to jslint.com and enter that

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.