views:

17

answers:

1

Firstly I'm really newbie in programming and now I want to develop system using asp but I got problem to create searching.

What I want is searching by date. When user select Feb (start) - Nov(end) then report will display below.

engine -use dreamweaver database - SQL Server

SQL for column select from column month and column year

Really need pro help.

thank and regard

<!--#include file="conn.asp" --> 
<%
Dim mySQL
mySQL="SELECT * FROM tbl_Master WHERE smonth='Jan'"

Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open mySQL, oConn

%>
<% 
Dim dropRS
Set dropRS=Request.QueryString("smonth")
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<form id="form1" name="form1" method="post" action="">
 <label>
  <select name="month" id="month">
    <option value="Jan">Jan</option>
    <option value="Feb">Feb</option>
  </select>
  </label>
  <label>
  <select name="select" id="select">
    <option value="2010">2010</option>
    <option value="2011">2011</option>
  </select>
  </label>
  <input name="sumbit" type="submit" value="Submit" label="sumbit" />
  <p>&nbsp;</p>
  <table>
<tr><td><% Response.Write objRS("DoNo") %></td></tr>
<tr><td><% Response.Write objRS("smonth") %></td></tr>
<tr><td><% Response.Write objRS("AssetStatus") %></td></tr>
</table>


</form>
</body>
</html>
<%
' Don't forget to close your connection after you display your data.
objRS.Close
Set objRS = Nothing
oConn.Close
Set oConn = Nothing
%>
A: 

I think you want to have two drop boxes... one smonth and one emonth (start and end)

then you get the values of each from querystring and store them in variables.. smonth = request.querystring("smonth") emonth = request.querystring("emonth")

After that you will just have to make a change to your sql statement to query based on both of those params...

mySQL="SELECT * FROM tbl_Master WHERE smonth='" & smonth & "' AND emonth='" & emonth & "';"

the above query is made up based on your users inputs and placed against a database.

franky b