Simple Question

Results 1 to 4 of 4

Thread: Simple Question

  1. #1
    Johnedo Guest

    Default Simple Question

    I have a DB with a number of fields...I want to provide the user with the facility of producing weekly reports based on their needs... For this i plan to keep a number of buttons on which if the user clicks those buttons those records would be retrieved from the DB and will be displayed on the next page... I want to know how to do this... If i have 4 buttons which imply 4 diff types of records to be generated then the user would click on one of those buttons, then those SQL queries would be executed and the reports would be generated...How do i do this...Please show me some piece of code which would do this....

  2. #2 Guest

    Default Do you want us to write it for you!

    If you need to ask how to do such a simple thing I doubt that you could write a program to do it, even if I explain it!<BR><BR>However I will try to give you a brief overview. First you would have a plain HTML page with the buttons:<BR><BR>&#060;form action=Report.asp method=post&#062;<BR>&#060;input type=submit name=button value=Report1&#062;<BR>&#060;input type=submit name=button value=Report2&#062;<BR>&#060;input type=submit name=button value=Report3&#062;<BR>&#060;input type=submit name=button value=Report4&#062;<BR>&#060;/form&#062;<BR><BR>This would give you a set of buttons displaying the names of your reports. Note that the buttons all have the same name. This makes it easy to request the value of the button which was pressed in the asp page. Whichever button is clicked is the value past to the script reports.asp, which would fire one of your predefined queries depending on the value:<BR><BR>&#060;%<BR>dim sqlQueryStr, Rs<BR><BR>Select Case Request.Form("Button")<BR>case "Report1"<BR>sqlQueryStr="Your query for Report1"<BR>case "Report1"<BR>sqlQueryStr="Your query for Report1"<BR>case "Report1"<BR>sqlQueryStr="Your query for Report1"<BR>case "Report1"<BR>sqlQueryStr="Your query for Report1"<BR>End Select<BR><BR>set Rs=Server.CreateObject("ADODB.RecordSet")<BR>rs.Op en sqlQueryStr, YourConnection<BR>%&#062;<BR><BR>You would then loop through the recordset and display the rows as per how you want your report to look. I have shown the bare minimum of what needs to be done. You will have to write cod eto connect to your DB and code to define the layout of your report.

  3. #3
    Join Date
    Dec 1969

    Default More than one way to skin a programmer

    Peter&#039s response kind of summarizes my gut feelings on this, also, but I thought I&#039d offer at least one alternative.<BR><BR>What you could do is actually put the QUERIES to be used as the values of the various radio buttons:<BR><BR>&#060;FORM...&#062;<BR>&#060;INPUT Type=Radio Name=WhichQuery Value="SELECT f1,f2,f3 FROM fooTable WHERE f1 LIKE &#039%xyz%&#039"&#062; xyz report<BR>&#060;INPUT Type=Radio Name=WhichQuery Value="SELECT * FROM barTable WHERE barDate &#062; #9/1/2000#"&#062; September bar report<BR>... etc. ...<BR>&#060;/FORM&#062;<BR><BR>And then, on the next page, you could simply do<BR><BR>&#060;%<BR>... set up connection ...<BR><BR>Set RS = conn.Execute( Request.Form("WhichQuery") )<BR><BR>... show data ...<BR>%&#062;<BR><BR>This is probably *NOT* really a thing you want to do. You probably want to incorporate other info dynamically, so static queries may not match what you need.<BR><BR>But I just wanted to show that there are *MANY* ways to solve problems in programming. More often than not, the programmer&#039s job is finding the most appropriate one for the task. One might even be so bold as to say that if you don&#039t see at least two ways to accomplish a task, then you probably don&#039t completely understand the task. Even if the second solution you find is inferior to the first, you probably shouldn&#039t stop until you find it, just to convince yourself that you do understand the problem.<BR><BR>Make sense?<BR><BR>

  4. #4
    Johnedo Guest

    Default RE: Do you want us to write it for you!

    U could be a bit more polite while giving an answer if u know sooo much Mr.!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts