Multiple Insert or Looping Insert

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

  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. Similar Questions and Discussions

    1. What's faster - loop for insert or insert...select.
      What is faster if I'm moving large numbers of records (anywhere from 10,000 to 300,000 records per archive) from one query to another table? 1)...
    2. insert multiple row
      How do i insert multiple rows in database. for example: I have 3 list: list1: a1,a2,a3,a4 list2: b1,b2,b3,b4 list3: c1,c2,c3,c4 I want to...
    3. Multiple DB Insert
      I have an XML file that has roughly 55,000 records. I need to parse the contents of the file and store it in a database. The problem I'm having is...
    4. Insert while looping
      I'm running a query from a text file to return data that I will then use to insert into SQL - could someone give an example as to how to insert...
    5. INSERT statement contains fewer items than the insert list
      The block of code below shows how I am inserting field values into my dbase table: strSQLStatement = "INSERT INTO tblArticles...
  3. #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" <webforumsuser@macromedia.com> wrote in message
    news:d7072v$44q$1@forums.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

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