Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2003, 05:58 AM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Creating a sale administration

Hi,

I want to build a sale page where weekly, the administrator can just just enter the information of the sale and its sale items, press submit and walla, the promotion sale page is updated with the new sale and its items.

I have created a database with 2 tables.
First of the actual sale called Specials and the other if for the items inside the specific sale called SpecialItems.

In the MS Access database, I have made a relationship between SpecialID in Specials(table) and SpecialID in SpecialItems(table).

Now in ASP, i want the administrator to create a Special, which should automatically create a new SpecialID in Specials(table), followed by choose the desired items (ItemID) in that special (SpecialID) in SpecialItem(table).

So does anyone know of a tutorial or code I can view for this? Or maybe help me out with this?
I am usuing MS Access as my database.


 
Old July 28th, 2003, 05:59 AM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Btw, Here is what I did, but i cant seem to retrieve the SpecialID at case "additems". Its like SpecialID comes back empty.
I also want to add more than one item at a time. How do I do that?
Here is my code:

<%
Dim Con, rsQuery

'Need to initialise all Database stuff first!
Set Con = Server.CreateObject("ADODB.Connection")
Set rsQuery = Server.CreateObject("ADODB.Recordset")
SpecialID = Request.QueryString("SpecialID")
strAction = Request.QueryString("Action")
'response.write request.servervariables("REMOTE_HOST")
'response.end
connStr = "Driver={Microsoft Access Driver (*.mdb)};" & _
          "Dbq=" & server.mappath("/database/content.mdb") & ";" & _
          " Uid=Admin;" & _
          "Pwd=;"
Con.Open connStr
'response.write (connStr)
'response.end

strTitle= Request.Form("SpTitle")
strLink= Request.Form("SpMoreInfoLink")
strStartDate= Request.Form("SpDateStart")
strEndDate= Request.Form("SpDateEnd")
strItemName= Request.Form("SpName")
strItemDesc= Request.Form("SpDesc")
strItemPrice= Request.Form("SpSalePrice")
strItemDel1= Request.Form("SpDeliveryTime")
strItemDel2= Request.Form("SpDeliveryPrice")
strItemPayType= Request.Form("SpPaymentType")
strSubmit = Request.Form("Submit")
If strSubmit = "Submit" Then
    '// Here we need to do all the database processing
    '// and updating.
    If action = addspecial Then
        Con.Execute("INSERT INTO Specials(SpTitle,SpMoreInfoLink,SpDateStart,SpDate End) VALUES(' " & strTitle & " ',' " & strLink & " ',' " & strStartDate & " ',' " & strEndDate & " ')")
        Set rsQuery = Con.Execute("SELECT SpecialID FROM Specials")
            'Response.Redirect ("add_special.asp?action=additems&SpecialID=" & SpecialID)
    Else If action = additems Then
        Con.Execute("INSERT INTO SpecialItems(SpName,SpDesc,SpSalePrice,SpDeliveryT ime,SpDeliveryPrice,SpPaymentType) VALUES(' " & strItemName & " ',' " & strItemDesc & " ',' " & strItemPrice & " ',' " & strItemDel1 & " ',' " & strItemDel2 & " ',' " & strItemPayType & " ')")
        Set rsQuery = Con.Execute("SELECT SpItemID FROM SpecialItems")
            'Response.Redirect "add_special.asp?action=addspecial"
    End If
    End If
Else
End If
Select Case strAction
    Case "addspecial"%>

    <form NAME="form1" METHOD="post" ACTION="add_special.asp?action=additems&SpecialID= <%=SpecialID%>">
      <table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
        <tr>
            <td>
                Special Title: <input type="text" size="50" name="SpTitle" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Link: <input type="text" size="50" name="SpMoreInfoLink" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Start Date: <input type="text" size="50" name="SpDateStart" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special End Date: <input type="text" size="50" name="SpDateEnd" value="">
            </td>
        </tr>
        <tr>
            <td>
                <input type="submit" value="Submit" name="submit">
            </td>
        </tr>
      </table>
    </form>

    <%Case "additems"%>

    <form NAME="form1" METHOD="post" ACTION="add_special.asp?action=addspecial">
      <table WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
        <tr>
            <td>
                Special Item Name: <input type="text" size="50" name="SpName" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Item Desc: <input type="text" size="50" name="SpDesc" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Item Price: <input type="text" size="50" name="SpSalePrice" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Item delivery time: <input type="text" size="50" name="SpDeliveryTime" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Item Deliery price: <input type="text" size="50" name="SpDeliveryPrice" value="">
            </td>
        </tr>
        <tr>
            <td>
                Special Item payment type: <input type="text" size="50" name="SpPaymentType" value="">
            </td>
        </tr>
        <tr>
            <td>
                <input type="submit" value="Submit" name="submit">
            </td>
        </tr>
      </table>
    </form>

<%End Select%>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Error creating user on the administration tool r__gery ASP.NET 2.0 Basics 3 May 23rd, 2007 07:59 AM
Entering Multiple Sale Items on a Form rika4750 Access 1 May 2nd, 2005 12:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.