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 8272087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:01:21+00:00 2026-06-08T07:01:21+00:00

I am trying to create forms where the user can input text in up

  • 0

I am trying to create forms where the user can input text in up to 3 forms. Each of the forms will correspond to columns in an SQL Server CE database table. Based on the text input into the forms, the page will display all rows that contain all of the specified text (with null values being treated as wildcards).

I have this working fine for 1 form. The form text is being assigned as a value for a variable and passed between the pages no problem. I am just not sure how in include the 2 other columns in the query.

Here is the code for the input page with the forms:

@{ 
var formValue1 = Request.Form["FN"];
var formValue2 = Request.Form["LN"];
var formValue3 = Request.Form["CPNY"];  
if (IsPost) 
 { 
       Response.Redirect("DisplaySearch.cshtml?firstname=" + formValue1);
       Response.Redirect("DisplaySearch.cshtml?lastname=" + formValue2);       
 } 
 }

<form action="" method="post">
First Name:<input type="text" ID="FN" name="FN" value=""></input><br>
Last Name:<input type="text" ID="LN" name="LN"></input><br>
Company:<input type="text" ID="CPNY" name="CPNY"></input>
<br>
<input type="submit" value="Search"></input></form>

Here is the code for the display page:

@using WebMatrix.Data 

@{
var Keyword1 = Request.QueryString["firstname"];    //Retrieves passed variable from    the database search page for First Names
var Keyword2 = Request.QueryString["lastname"];    //Retrieves passed variable from the database search page for First Names
var Keyword3 = Request.QueryString["company"];    //Retrieves passed variable from the database search page for First Names
var db= Database.Open("Orientation"); 
var sqlQ = "SELECT * FROM Orientation WHERE FirstName LIKE @0";
var data = db.Query(sqlQ,  "%" + Keyword1 + "%");  
 }

<div class="content-box-main">

<ol>
@foreach(var row in data){
<li>
@row.LastName, @row.FirstName, @row.MiddleName, @row.Email, @row.Company, @row.Date
</li>
}
</ol><br>

</div>

Help is greatly appreciated! I am a noob to create web applications and my only programming experience up to 2 weeks ago was the odd VBA macro in Office. I will also mention again, I am using WebMatrix and SQL Server CE. I know that there are some limitations with SQL Server CE, although I enjoy the ease of use for me being a noob. If anyone has any suggestions for different SQL Server program to use, I would be open to hearing them.

Thanks!

James

  • 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-08T07:01:22+00:00Added an answer on June 8, 2026 at 7:01 am
       Response.Redirect("DisplaySearch.cshtml?firstname=" + formValue1 + "&lastname=" + formValue2 + "&company=" + formValue3);
    

    and

    var sqlQ = "SELECT * FROM Orientation WHERE FirstName LIKE @0 AND LastName LIKE @1 AND Company LIKE @2";
    var data = db.Query(sqlQ,  "%" + Keyword1 + "%", "%" + Keyword2 + "%", "%" + Keyword3 + "%");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a form where the user can input their id (username)
I'm trying to create a consent form, and having the user input their name.
I am trying to create a table, whereas when the user clicks on one
I'm trying to create a calculator where the user can put in 4 values,
I'm creating a simple back-end app through which the user can create/update/delete database rows
I'm trying to create a form where the a user can click a checkbox
I'm trying to create an app in Visual Basic that will allow a user
I'm trying to create a webpage where the user can submit information that they
I'm trying to create a child form that helps the user to enter data
I am trying to create an asp.net web form that allows a user to

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.