Expression Web help

Join our community


Search an access database

Searching an access database in expression web is actually quite easy to do. The process requires you to have v2 provided by your host.

An example can be seen here.

Create a new aspx page and save it. (give it any name you like - in my case i called it textsearch.aspx.

From the toolbox task pane, select, drag and drop an text box control onto your page.

Next, select, drag and drop an button and place it next to the text box.

Finally, select, drag and drop a data list control from the data control toolbox and place it directly under the text box and button. You will be asked to create a data source by the data list control. Navigate to you database and select the fields that you will want to display.

When you have selected your data source, you need to click the next button.

You will be presented with the Configure select statement dialogue box. Select the database table that holds the data that you want your users to see, and select the items you want to display from that table.

Make sure you check the show only unique records box and then click on the where button to create a where clause.

How you proceed from here, depends on how your database is set up. My database has a table for pet details and within that are records showing quite a bit of info. However, i want to only show part of the database and in this case i want to show, animal shelter, location, county, contact name and telephone number. Why? Well my search box allows users to type in a location and the results of pet shelters in that location will be shown.

So in the where clause, select the column that is relevant to the search. In my case its location.

Make sure the operator is set to equals (=) and then click on the source dropdown and select control (a text box is a control) then from the parameter properties control ID dropdown select textbox1. (this is the default name of the control. If you have more than 1 text box control you will see textbox1, textbox2 and so on. You can change the names of the controls if you wish)

When you have selected the textbox1 control click on the add button to add the where clause.

So briefly, we are saying that we want to see the results for location when the location is equal to the contents of the text box.

Nearly done.

Really all that remains now is to make the button do some thing.

What we want is when a user types some text into the textbox and hits the button, the button needs to send that information somewhere. In this case it needs to send the info back to the page that the textbox and button are on.

So click on the button and then under the Tag Properties task pane, scroll through the options until you get to the behavior section, find postback url. if you click this a small button will show allowing you to click and navigate to the page you need. (this will be the page you are currently working on - so the button posts back to the same page)

Click save and test it in your browser.

You can change the text on the button by clicking on it and changing the text, again in the Tag Properties task pane.

You can control the look of the data display in the data list control by clicking on it and then clicking the small grey arrow on the right side of the control. Here you can edit the template, and or format how the results are displayed.

A using data in expression web tutorial is here.

Discuss this in our expression web forum?

Microsoft MVP


Our forum feed can be found here

Add RSS to Yahoo

Add to Google

Reader not listed? Click here for more options

Expression Web Help RSS
Expression Web Help. Tips and Tricks and tutorials Get our feed now