Professional Web Applications Themes

Multiple Insert or Looping Insert - Dreamweaver AppDev

I built an application on an Access DB that allows a dispatcher to log trucks in the field at their location as they call in. There are three backend tables, Codes (for calling in on the radio), Trucks (for each unique truck), and Events to log the truck at location with a code. The problem I am having is I would like to use a CheckBoxList for the dynamically generated truck list. That would allow the dispatcher to log more than one record with one submission. Does anyone know an easy way to insert a record for each truck selected ...

  1. #1

    Default Multiple Insert or Looping Insert

    I built an application on an Access DB that allows a dispatcher to log trucks
    in the field at their location as they call in. There are three backend
    tables, Codes (for calling in on the radio), Trucks (for each unique truck),
    and Events to log the truck at location with a code. The problem I am having
    is I would like to use a CheckBoxList for the dynamically generated truck list.
    That would allow the dispatcher to log more than one record with one
    submission.

    Does anyone know an easy way to insert a record for each truck selected in the
    checkboxlist? It will use the same data from codes and whatever is entered for
    location upon submission. I cannot use a stored procedure because of Access.
    Can I loop the insert that Dreamweaver creates? Does anyone know a better way
    to do multiple inserts into a table using a checkboxlist?

    Following is what Dreaweaver has generated for the Insert:


    <MM:Insert
    runat="server"
    CommandText='<%# "INSERT INTO tblEvents (TruckID, CodeID, Location, Notes)
    VALUES (?, ?, ?, ?)" %>'
    ConnectionString='<%#
    System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_con
    nRadioLogASP") %>'
    DatabaseType='<%#
    System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETY
    PE_connRadioLogASP") %>'
    Expression='<%# Request.Form("MM_insert") = "form1" %>'
    CreateDataSet="false"
    SuccessURL='<%# "index.aspx" %>'
    Debug="true"
    >
    <Parameters>
    <Parameter Name="TruckID" Value='<%# IIf((Request.Form("TruckID") <>
    Nothing), Request.Form("TruckID"), "") %>' Type="WChar" />
    <Parameter Name="CodeID" Value='<%# IIf((Request.Form("CodeID") <>
    Nothing), Request.Form("CodeID"), "") %>' Type="Integer" />
    <Parameter Name="Location" Value='<%# IIf((Request.Form("Location") <>
    Nothing), Request.Form("Location"), "") %>' Type="WChar" />
    <Parameter Name="Notes" Value='<%# IIf((Request.Form("Notes") <>
    Nothing), Request.Form("Notes"), "") %>' Type="WChar" />
    </Parameters>
    </MM:Insert>

    payado Guest

  2. #2

    Default Re: Multiple Insert or Looping Insert

    There are some tutorials on [url]www.charon.co.uk[/url] that show how to code multiple
    inserts but they are ASP based. You could adapt the code for ASP.Net but it
    would mean not using the MM:Insert tag.

    --
    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]

    "payado" <webforumsusermacromedia.com> wrote in message
    news:d7072v$44q$1forums.macromedia.com...
    > I built an application on an Access DB that allows a dispatcher to log
    trucks
    > in the field at their location as they call in. There are three backend
    > tables, Codes (for calling in on the radio), Trucks (for each unique
    truck),
    > and Events to log the truck at location with a code. The problem I am
    having
    > is I would like to use a CheckBoxList for the dynamically generated truck
    list.
    > That would allow the dispatcher to log more than one record with one
    > submission.
    >
    > Does anyone know an easy way to insert a record for each truck selected
    in the
    > checkboxlist? It will use the same data from codes and whatever is
    entered for
    > location upon submission. I cannot use a stored procedure because of
    Access.
    > Can I loop the insert that Dreamweaver creates? Does anyone know a better
    way
    > to do multiple inserts into a table using a checkboxlist?
    >
    > Following is what Dreaweaver has generated for the Insert:
    >
    >
    > <MM:Insert
    > runat="server"
    > CommandText='<%# "INSERT INTO tblEvents (TruckID, CodeID, Location,
    Notes)
    > VALUES (?, ?, ?, ?)" %>'
    > ConnectionString='<%#
    >
    System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING
    _con
    > nRadioLogASP") %>'
    > DatabaseType='<%#
    >
    System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABA
    SETY
    > PE_connRadioLogASP") %>'
    > Expression='<%# Request.Form("MM_insert") = "form1" %>'
    > CreateDataSet="false"
    > SuccessURL='<%# "index.aspx" %>'
    > Debug="true"
    > >
    > <Parameters>
    > <Parameter Name="TruckID" Value='<%# IIf((Request.Form("TruckID") <>
    > Nothing), Request.Form("TruckID"), "") %>' Type="WChar" />
    > <Parameter Name="CodeID" Value='<%# IIf((Request.Form("CodeID") <>
    > Nothing), Request.Form("CodeID"), "") %>' Type="Integer" />
    > <Parameter Name="Location" Value='<%# IIf((Request.Form("Location")
    <>
    > Nothing), Request.Form("Location"), "") %>' Type="WChar" />
    > <Parameter Name="Notes" Value='<%# IIf((Request.Form("Notes") <>
    > Nothing), Request.Form("Notes"), "") %>' Type="WChar" />
    > </Parameters>
    > </MM:Insert>
    >

    Paul Whitham TMM Guest

Similar Threads

  1. Question Insert from ASP to SQL using recordset data as values in insert statement
    By JasonM in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 13th, 05:54 PM
  2. insert multiple row
    By sweetyp2005 in forum Coldfusion Database Access
    Replies: 2
    Last Post: October 26th, 11:57 AM
  3. Multiple DB Insert
    By Abs0 in forum Coldfusion - Advanced Techniques
    Replies: 6
    Last Post: June 28th, 08:56 PM
  4. Insert while looping
    By Dave Karmens in forum ASP Database
    Replies: 3
    Last Post: March 2nd, 05:48 AM
  5. Replies: 3
    Last Post: September 30th, 09:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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