Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MS Access (http://www.go4expert.com/forums/ms-access-forum/)
-   -   Database connection Difficulties (http://www.go4expert.com/forums/database-connection-difficulties-t4583/)

MastaKay 6Jun2007 14:23

Database connection Difficulties
 
Hi.

I have a MS Access database called TelephoneList, that has a table called Characters.Now, I have a webpage with a dropdownlistbox preloaded with characters(A-Z).When I select a character, I want the page to extract values from the page using that character to filter the values.(i.e. Select select name, surname from Character where FilterByChar = Dropdownlist.SelectedItem).

First.How do I establish a connection, command, and datareader to allow me to do this.

A sample code would be very nice thank you.

My current one is****
Code:

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("/db/TelephoneList.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
sql="SELECT Name, Surname, Department, Xtension, [Other Extension] FROM Characters where Xtension = "****Dont knw how to do the where statement
rs.Open sql, conn
%>

<table border="1" width="100%">
<tr>
<%for each x in rs.Fields
    response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
    <tr>
    <%for each x in rs.Fields%>
      <td><%Response.Write(x.value)%></td>
    <%next
    rs.MoveNext%>
    </tr>
<%loop
rs.close
conn.close
%>



All times are GMT +5.5. The time now is 13:52.