Inserting value into database based on other fields

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Inserting value into database based on other fields

    Hi,

    I have 3 fields in a form: CATEGORY, NUMBER and YEAR. In addition to
    inserting these 3 fields into a database table, I would like to insert a 4th
    one which is a combination of all three fields, with each field seperated by
    a hyphen E.g.

    CATEGORY-NUMBER-YEAR

    or

    31-01-05

    I need this 4th field to be inserted as SERIAL_NO

    I know how to use the insert record behaviour but that only picks up the 3
    designated fields. I don't know how to A) create the fourth from the
    combination of the previous 3 and B) insert it into the table
    'PRODUCT_DESCRIPTION'

    Can anyone help?


    Mintyman Guest

  2. Similar Questions and Discussions

    1. Inserting Time to a SQL Database
      I'm builidng a program that requires me to record the time of day that a department physcially receives a document and then when it leaves the...
    2. Inserting Currency into database
      Hello, This should be an easy one, but somehow it eludes me. I have an update form where I display dollar amounts. I am using...
    3. inserting the time into database
      hi i have a page where all the stories are displayed, ordered by colomn "date" descsending. the problem is that if two stories are enter on the...
    4. Problems inserting layer on to template based page
      I'm trying to add a layer onto a page that is based on a template. When I tried to insert the layer, I got the following error message from...
    5. inserting a database into director
      Hello, Is there any way to insert a database into director? by using lingo, or with an extra. The user needn´t modify the database, he would...
  3. #2

    Default Re: Inserting value into database based on other fields

    How easy this is depends upon the server model being used. If you are usign
    ASP the DW generated coded is pretty hard to decipher, in which case I would
    recommend that you manually write an insert statement.

    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "Mintyman" <mintyman@ntlworld.com> wrote in message
    news:d0jsoc$egm$1@forums.macromedia.com...
    > Hi,
    >
    > I have 3 fields in a form: CATEGORY, NUMBER and YEAR. In addition to
    > inserting these 3 fields into a database table, I would like to insert a
    4th
    > one which is a combination of all three fields, with each field seperated
    by
    > a hyphen E.g.
    >
    > CATEGORY-NUMBER-YEAR
    >
    > or
    >
    > 31-01-05
    >
    > I need this 4th field to be inserted as SERIAL_NO
    >
    > I know how to use the insert record behaviour but that only picks up the 3
    > designated fields. I don't know how to A) create the fourth from the
    > combination of the previous 3 and B) insert it into the table
    > 'PRODUCT_DESCRIPTION'
    >
    > Can anyone help?
    >
    >

    Paul Whitham TMM Guest

  4. #3

    Default Re: Inserting value into database based on other fields

    its ASP with VBScript im using. Does help you find a solution for me?


    "Paul Whitham TMM" <paul@valleybiz.net> wrote in message
    news:d0l8nb$mki$1@forums.macromedia.com...
    > How easy this is depends upon the server model being used. If you are
    usign
    > ASP the DW generated coded is pretty hard to decipher, in which case I
    would
    > recommend that you manually write an insert statement.
    >
    > --
    > Regards
    >
    > Paul Whitham
    > Macromedia Certified Professional for Dreamweaver MX2004
    > Valleybiz Internet Design
    > [url]www.valleybiz.net[/url]
    >
    > Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    > [url]www.macromedia.com/support/forums/team_macromedia[/url]
    >
    > "Mintyman" <mintyman@ntlworld.com> wrote in message
    > news:d0jsoc$egm$1@forums.macromedia.com...
    > > Hi,
    > >
    > > I have 3 fields in a form: CATEGORY, NUMBER and YEAR. In addition to
    > > inserting these 3 fields into a database table, I would like to insert a
    > 4th
    > > one which is a combination of all three fields, with each field
    seperated
    > by
    > > a hyphen E.g.
    > >
    > > CATEGORY-NUMBER-YEAR
    > >
    > > or
    > >
    > > 31-01-05
    > >
    > > I need this 4th field to be inserted as SERIAL_NO
    > >
    > > I know how to use the insert record behaviour but that only picks up the
    3
    > > designated fields. I don't know how to A) create the fourth from the
    > > combination of the previous 3 and B) insert it into the table
    > > 'PRODUCT_DESCRIPTION'
    > >
    > > Can anyone help?
    > >
    > >
    >
    >

    Mintyman Guest

  5. #4

    Default Re: Inserting value into database based on other fields

    This is a hand coded ASP Insert statement

    <%
    dim strConn
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("/_database/Conf2005.mdb")
    dim strTitle
    dim strContent
    strTitle = Request.Form("txtTitle")
    strContent = Request.Form("txtContent")

    dim adoCn
    dim strSQL
    set adoCn = Server.CreateObject("ADODB.Connection")
    adoCn.Open strConn
    strSQL = "Insert Into TblPageContent (PageName, Introtext) Values ('" &
    replace(strTitle,"'","''") & "','" & replace(strContent,"'","''") & "')"
    adoCn.Execute strSQL
    adoCn.Close
    set adoCn = nothing
    %>

    To create a variable that would add fields together you would do something
    like this

    Dim strSerial
    strSerial = Request.Form("CATEGORY") & "-" & Request.Form("NUMBER") & "-" &
    Request.Form("YEAR")

    and then add it to the insert line.

    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "Mintyman" <mintyman@ntlworld.com> wrote in message
    news:d0n2eq$gjq$1@forums.macromedia.com...
    > its ASP with VBScript im using. Does help you find a solution for me?
    >
    >
    > "Paul Whitham TMM" <paul@valleybiz.net> wrote in message
    > news:d0l8nb$mki$1@forums.macromedia.com...
    > > How easy this is depends upon the server model being used. If you are
    > usign
    > > ASP the DW generated coded is pretty hard to decipher, in which case I
    > would
    > > recommend that you manually write an insert statement.
    > >
    > > --
    > > Regards
    > >
    > > Paul Whitham
    > > Macromedia Certified Professional for Dreamweaver MX2004
    > > Valleybiz Internet Design
    > > [url]www.valleybiz.net[/url]
    > >
    > > Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    > > [url]www.macromedia.com/support/forums/team_macromedia[/url]
    > >
    > > "Mintyman" <mintyman@ntlworld.com> wrote in message
    > > news:d0jsoc$egm$1@forums.macromedia.com...
    > > > Hi,
    > > >
    > > > I have 3 fields in a form: CATEGORY, NUMBER and YEAR. In addition to
    > > > inserting these 3 fields into a database table, I would like to insert
    a
    > > 4th
    > > > one which is a combination of all three fields, with each field
    > seperated
    > > by
    > > > a hyphen E.g.
    > > >
    > > > CATEGORY-NUMBER-YEAR
    > > >
    > > > or
    > > >
    > > > 31-01-05
    > > >
    > > > I need this 4th field to be inserted as SERIAL_NO
    > > >
    > > > I know how to use the insert record behaviour but that only picks up
    the
    > 3
    > > > designated fields. I don't know how to A) create the fourth from the
    > > > combination of the previous 3 and B) insert it into the table
    > > > 'PRODUCT_DESCRIPTION'
    > > >
    > > > Can anyone help?
    > > >
    > > >
    > >
    > >
    >
    >

    Paul Whitham TMM 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