ASP help required please

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default ASP help required please

    Hey Al
    I have a stored procedure in SQL server which when exectuated returns a table of results. I would like to be able to pass in the parameters from a form into the stored procedures and then view the table of results in a html table when the submit button is clicked.

    The parameters for my SQL statement are:
    @weekenddate1, @weekenddate2, @txtpub, @txtprice and @txtDescriptio

    Can anyone help me write the asp code to pass these values into a form and return a table of results on a new html page

    My html form looks like the following:
    <form name="form1" method="post" action=""><table width="52%" border="0"><tr><td width="43%">FROM DATE</td><td width="57%"><input name="fromdate" type="text" id="fromdate"></td></tr><tr><td>TO DATE</td><td><input name="todate" type="text" id="todate"></td></tr><tr><td>PUBLICATION</td><td><input name="publication" type="text" id="publication"></td></tr><tr><td>PRICE</td><td><input name="price" type="text" id="price"></td></tr><tr><td>DESCRIPTION</td><td><input name="description" type="text" id="description"></td></tr><tr><td>&nbsp;</td><td><input name="VIEW_REPORT" type="submit" id="VIEW_REPORT" value="Submit"><input name="CLEAR" type="reset" id="CLEAR" value="Reset"></td></tr></table></form

    I will be so so so so pleased if anyone is able to help me. My asp knowledge is minimal
    Stephen Guest

  2. Similar Questions and Discussions

    1. Help Required
      Hi, I want to deploy my private shared assembly using codebase keeping some of the assemblies in common folder. I am using following tag in...
    2. required help
      I believe you meant to send this message to the Perl Beginner's List. On Monday, October 6, 2003, at 01:51 AM, vaishali wrote: Let's see if...
    3. Help required please!
      OK, I have Photoshop7 (Uk) and have 80 something images I want to downsize from 3000 x 2000. Do I have to do each one individually? Thanks in...
    4. what is required for job(?)
      is there a list on the web , on what a 3D animator needs to prepare himself with, or what he needs to show, for the job market? thanx....doc
    5. Job schedular Required for IIS
      Hy, I need Job schedular like MSSQL server, I need this functionality on IIS. Is there any concept of threads on IIS? Thank You.
  3. #2

    Default ASP help required please

    Hey All,
    I have a stored procedure in SQL server which when exectuated returns a table of results. I would like to be able to pass in the parameters from a form into the stored procedures and then view the table of results in a html table when the submit button is clicked.

    The parameters for my SQL statement are:
    @weekenddate1, @weekenddate2, @txtpub, @txtprice and @txtDescriptio

    Can anyone help me write the asp code to pass these values into a form and return a table of results on a new html page

    My html form looks like the following:
    <form name="form1" method="post" action=""><table width="52%" border="0"><tr><td width="43%">FROM DATE</td><td width="57%"><input name="fromdate" type="text" id="fromdate"></td></tr><tr><td>TO DATE</td><td><input name="todate" type="text" id="todate"></td></tr><tr><td>PUBLICATION</td><td><input name="publication" type="text" id="publication"></td></tr><tr><td>PRICE</td><td><input name="price" type="text" id="price"></td></tr><tr><td>DESCRIPTION</td><td><input name="description" type="text" id="description"></td></tr><tr><td>&nbsp;</td><td><input name="VIEW_REPORT" type="submit" id="VIEW_REPORT" value="Submit"><input name="CLEAR" type="reset" id="CLEAR" value="Reset"></td></tr></table></form

    I will be so so so so pleased if anyone is able to help me. My asp knowledge is minimal
    Stephen Guest

  4. #3

    Default Re: ASP help required please

    [url]http://www.aspfaq.com/5003[/url]

    --

    Ray at home
    Microsoft ASP MVP


    "Stephen" <stephensenterprises@hotmail.com> wrote in message
    news:9A78230B-9B98-4BF0-93CE-5FB668F49E00@microsoft.com...
    > Hey All
    > I have a stored procedure in SQL server which when exectuated returns a
    table of results. I would like to be able to pass in the parameters from a
    form into the stored procedures and then view the table of results in a html
    table when the submit button is clicked.
    >
    > The parameters for my SQL statement are: -
    > @weekenddate1, @weekenddate2, @txtpub, @txtprice and @txtDescription
    >
    > Can anyone help me write the asp code to pass these values into a form and
    return a table of results on a new html page.
    >
    > My html form looks like the following: -
    > <form name="form1" method="post" action=""><table width="52%"
    border="0"><tr><td width="43%">FROM DATE</td><td width="57%"><input
    name="fromdate" type="text" id="fromdate"></td></tr><tr><td>TO
    DATE</td><td><input name="todate" type="text"
    id="todate"></td></tr><tr><td>PUBLICATION</td><td><input name="publication"
    type="text" id="publication"></td></tr><tr><td>PRICE</td><td><input
    name="price" type="text"
    id="price"></td></tr><tr><td>DESCRIPTION</td><td><input name="description"
    type="text" id="description"></td></tr><tr><td>&nbsp;</td><td><input
    name="VIEW_REPORT" type="submit" id="VIEW_REPORT" value="Submit"><input
    name="CLEAR" type="reset" id="CLEAR" value="Reset"></td></tr></table></form>
    >
    > I will be so so so so pleased if anyone is able to help me. My asp
    knowledge is minimal


    Ray at Guest

  5. #4

    Default Re: ASP help required please

    [url]http://www.aspfaq.com/5003[/url]

    --

    Ray at home
    Microsoft ASP MVP


    "Stephen" <stephensenterprises@hotmail.com> wrote in message
    news:67F9EA5E-BD89-4AA2-B68A-974CBD9D9FE8@microsoft.com...
    > Hey All,
    > I have a stored procedure in SQL server which when exectuated returns a
    table of results. I would like to be able to pass in the parameters from a
    form into the stored procedures and then view the table of results in a html
    table when the submit button is clicked.
    >
    > The parameters for my SQL statement are: -
    > @weekenddate1, @weekenddate2, @txtpub, @txtprice and @txtDescription
    >
    > Can anyone help me write the asp code to pass these values into a form and
    return a table of results on a new html page.
    >
    > My html form looks like the following: -
    > <form name="form1" method="post" action=""><table width="52%"
    border="0"><tr><td width="43%">FROM DATE</td><td width="57%"><input
    name="fromdate" type="text" id="fromdate"></td></tr><tr><td>TO
    DATE</td><td><input name="todate" type="text"
    id="todate"></td></tr><tr><td>PUBLICATION</td><td><input name="publication"
    type="text" id="publication"></td></tr><tr><td>PRICE</td><td><input
    name="price" type="text"
    id="price"></td></tr><tr><td>DESCRIPTION</td><td><input name="description"
    type="text" id="description"></td></tr><tr><td>&nbsp;</td><td><input
    name="VIEW_REPORT" type="submit" id="VIEW_REPORT" value="Submit"><input
    name="CLEAR" type="reset" id="CLEAR" value="Reset"></td></tr></table></form>
    >
    > I will be so so so so pleased if anyone is able to help me. My asp
    knowledge is minimal


    Ray at Guest

  6. #5

    Default Re: ASP help required please

    Stephen wrote:
    > Hey All,
    > I have a stored procedure in SQL server which when exectuated returns
    > a table of results. I would like to be able to pass in the
    > parameters from a form into the stored procedures and then view the
    > table of results in a html table when the submit button is clicked.
    >
    > The parameters for my SQL statement are: -
    > @weekenddate1, @weekenddate2, @txtpub, @txtprice and @txtDescription
    >
    > Can anyone help me write the asp code to pass these values into a
    > form and return a table of results on a new html page.
    >
    > My html form looks like the following: -
    > <form name="form1" method="post" action="">
    <snip>


    You did not mention the name of the stored procedure ... I will call it
    GetRecords. Where you see "GetRecords" below, substitute the name of your
    procedure.

    It would also have been helpful to see the datatypes of those parameters. In
    the future, show the beginning of the stored procedure's creation script,
    the part that says:

    CREATE PROCEDURE <procedurename> (
    <parameters> )
    AS

    Tip: The first line of your procedure following "AS" should be:

    SET NOCOUNT ON

    This will prevent informational messages from being sent to the client as
    resultsets, and improve performance as well.

    I will assume the two dates are datetime and the three txt ones are
    character (although why anyone would use a character datatype for a price is
    beyond me)


    Create a new page called "displayrecords.asp". Modify the above form tag in
    your initial page to:
    <form name="form1" method="post" action="displayrecords.asp">

    The following code in displayrecords.asp will display a very basic table,
    very quickly. If you need more control over the table properties, use
    GetRows as described in this article: [url]http://www.aspfaq.com/show.asp?id=2467[/url]

    <%
    Option Explicit
    Dim cn, rs, dDate1, dDate2, sPub, sPrice, sDesc
    Dim bValid, sHTML
    dDate1=CDate(Request.Form("fromdate"))
    dDate2=CDate(Request.Form("todate"))
    sPub=Request.Form("publication")
    sPrice=Request.Form("price")
    sDesc=Request.Form("description")

    'Validate the above data - make sure they contain what
    'they are supposed to contain. If not, display an error
    'message to the user and set bValid to false
    'set the bValid variable to true if the data is valid, then:

    If bValid = true then
    set cn=server.createobject("adodb.connection")

    'substitute your information below - do not use the sa
    'account! Create a sql login with the minimum rights
    'needed - basically, it needs to be able to run this stored
    'procedure

    'You may want to do this in an include file

    cn.open "Provider=sqloledb;" & _
    "Data Source=yourserver;" & _
    "Initial Catalog=yourdatabase;" & _
    "User ID = sql_login_name;" & _
    "Password = sql_password"
    set rs=server.createobject("adodb.recordset")
    cn.GetRecords dDate1, dDate2, sPub, sPrice, _
    sDesc, rs
    if rs.eof then
    response.write "No records were returned"
    else
    Response.Write "<table border=1><tr><td>"
    sHTML=rs.GetString(2,,"</td><td>", _
    "</td></tr><tr><td>")
    sHTML = Left(sHTML, len(sHTML) - 8)
    response.Write sHTML
    response.write "</table>"
    end if
    rs.close: set rs=nothing
    cn.close: set cn=nothing
    end if
    %>

    HTH,
    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139