View Single Post
Old 02-02-2013, 01:16 AM   PM User | #1
bdenny20
New Coder

 
Join Date: Jan 2013
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
bdenny20 is an unknown quantity at this point
Returning Search Results

Hi again,
Require some more help.
So, I'm using WebMatrix as a learning platform with ASP.NET. Having a good time.

I ran through the "Bakery" demo from W3Schools, and I am trying to make a database search function based on what I learned from the demo. I haven't had much luck.

Well, I made a demo database (Airports.sdf) with a table by the same name. It has 5 sample rows with 5 columns. There is an ID column, but the primary column users would use to search by is the column called 'ICAO', a four letter code.


So, from the demo, I learned about
Code:
var db = Database.Open("Airports"); 
var query = db.Query("SELECT * FROM Airports ORDER BY ID");
with

Code:
@foreach(var row in query)
in an HTML table. Makes all the entries show up nicely. Cool.


What I am trying to do is take a text input bar, and a submit button, and have a user be able to enter the 4 letter ICAO, and after clicking the submit button, the corresponding entry and all it's columns appear in a HTML table.

So far I haven't gotten the right phrasing of the db.Query and I don't know how to tie it to a button.

Google suggestions gave me incredibly complicated solutions that I can not understand at this point, at first I thought this was a simple process, but could I be wrong?


Thanks in advance.

Billr
bdenny20 is offline   Reply With Quote