473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Multi Inset to a Database

How can I Multi Inset to a Database? I have been working on but cant seem to get it right. I have a form with unique field names. I am having an issue where I can insert multi records but its inserting blank info too.


-- Form
Expand|Select|Wrap|Line Numbers
  1. <form name="inbound_form" action="Save.asp" method="post">
  2.  
  3. <table width="1226">
  4. <tr>
  5.   <td width="302" class="theader">Provider</td>
  6.   <td width="302" class="theader">Number Type</td>
  7.   <td width="302" class="theader">Network Carrier</td>
  8.   <td width="302" class="theader">Number Function</td>
  9. </tr>
  10. <tr>
  11.   <td><input name="NumberProvider1" type="text" class="textfield" id="NumberProvider" value="" /></td>
  12.   <td><input name="NumberType1" type="text" class="textfield" id="NumberType1" value="" maxlength="" /></td>
  13.   <td><input name="NetworkCarrier1" type="text" class="textfield" id="NetworkCarrier1" value="" /></td>
  14.   <td><input name="NumberFunction1" type="text" class="textfield" id="NumberFunction1" value="" /></td>
  15.   </tr>
  16. <tr>
  17.   <td><input name="NumberProvider2" type="text" class="textfield" id="NumberProvider2" value="" /></td>
  18.   <td><input name="NumberType2" type="text" class="textfield" id="NumberType2" value="" maxlength="" /></td>
  19.   <td><input name="NetworkCarrier2" type="text" class="textfield" id="NetworkCarrier2" value="" /></td>
  20.   <td><input name="NumberFunction2" type="text" class="textfield" id="NumberFunction2" value="" /></td>
  21.   </tr>
  22. <tr>
  23.   <td><input name="NumberProvider3" type="text" class="textfield" id="NumberProvider3" value="" /></td>
  24.   <td><input name="NumberType3" type="text" class="textfield" id="NumberType3" value="" maxlength="" /></td>
  25.   <td><input name="NetworkCarrier3" type="text" class="textfield" id="NetworkCarrier3" value="" /></td>
  26.   <td><input name="NumberFunction3" type="text" class="textfield" id="NumberFunction3" value="" /></td>
  27.   </tr>
  28. <tr>
  29.   <td><input name="NumberProvider4" type="text" class="textfield" id="NumberProvider4" value="" /></td>
  30.   <td><input name="NumberType4" type="text" class="textfield" id="NumberType4" value="" maxlength="" /></td>
  31.   <td><input name="NetworkCarrier4" type="text" class="textfield" id="NetworkCarrier4" value="" /></td>
  32.   <td><input name="NumberFunction4" type="text" class="textfield" id="NumberFunction4" value="" /></td>
  33.   </tr>
  34. <td><input type="submit" name="hidden" id="Save" value="Save &amp; Close" /></td>
  35.   </tr>
  36. </table>
  37. </form>

-- Code
Expand|Select|Wrap|Line Numbers
  1. <%    
  2.     'Dealcare the variables 
  3.             'Dim Conn4, Rs4, NumberProvider, NumberType, NextworkCarrier, NumberStatus, NumberFunction
  4.  
  5.             ' Open objects 
  6.             Set Conn4 = Server.CreateObject("ADODB.Connection")
  7.             Conn4.Open  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("db.mdb")
  8.  
  9.             'For row = 1 Request.Form("NumberProvider").count
  10.             For row = 1 To 16
  11.             NumberProvider = Left(Request.Form("NumberProvider" & row), 14)
  12.             If IsNull(NumberProvider) OR IsEmpty(NumberProvider) Then Exit For
  13.             NumberProvider = Left(Request.Form("NumberProvider" & Row),14)  
  14.             NumberType = Left(Request.Form("NumberType" & Row),10)  
  15.             NetworkCarrier = Left(Request.Form("NetworkCarrier"& Row),15)  
  16.             NumberStatus = Left(Request.Form("NumberStatus"& Row),12)  
  17.             NumberFunction =  Left(Request.Form("NumberFunction"& Row),14)  
  18.  
  19.             FootPrint_AddedDate = Now
  20.  
  21.             ' Check that field values that are null 
  22.              Response.Write "<br/>"
  23.             Response.Write (NumberProvider)
  24.             Response.Write "<br/>"
  25.             Response.Write (NumberType)
  26.             Response.Write "<br/>"
  27.             Response.Write (NetworkCarrier)
  28.             Response.Write "<br/>"
  29.             Response.Write (NumberStatus)
  30.             'Response.Write "<br/>"
  31.             Response.Write (NumberFunction)
  32.             Response.Write "<br/>"
  33.  
  34.  
  35.             sql4 = "INSERT INTO InventoryStockInbound (NumberProvider, NumberType, NetworkCarrier, NumberStatus, NumberFunction, FootPrint_AddedDate, ShowStock)" _
  36.                     &"VALUES ('"&NumberProvider&"','"&NumberType&"','"&NetworkCarrier&"','"&NumberStatus&"','"&NumberFunction&"','"&FootPrint_AddedDate&"', True)"     
  37.             'SQl4 Debug
  38.             'Response.Write(sql4)
  39.  
  40.             Conn4.Execute sql4
  41.             'End If
  42.             Next
  43.             Conn4 = Close
  44. %>
Aug 7 '12 #1
1 1426
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code.

You're only running one INSERT statement so it's only going to insert one row. If you want to insert multiple rows, you'll need to run it multiple times.
Aug 7 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RipTide | last post by:
Background: Using an unsupported/abandoned multi-user multi-database program that uses Access 97 and Jet 3.5. Program itself appears to have been built with PowerBuilder 6.5. Databases reside on...
0
by: Mystic | last post by:
Hi, This is my first post, and I appreciate any help anybody can give. I have been working with databases for a couple of years now, but only at a single database level (i.e a single database...
1
by: socasteel21 via AccessMonster.com | last post by:
I have a multi-user database that stores warranty claims. I would like to be able to export all critical tables to a backup database when the introductory form is opened. The problem is the...
7
by: =?Utf-8?B?Um9nZWxpbw==?= | last post by:
hey, I have 2 threads, th and th2, both of them run a method. each of these 2 methods requires database access. sometimes I get an error, that database requires an open connection, and that...
3
by: jonosborne | last post by:
I know this is very long-winded but I am trying to include all information. I currently manage a data input database which is used within a multiple user environment. This data is stored within...
0
by: slider | last post by:
hey all, first question i have is, can i create a database using Microsoft Access 2003 and run it on a local network for multi access and simultaneous access? or do i need to use a program such as...
2
by: CoopEng | last post by:
Hey all, I've been pouring through hundreds of forums recently and finally decided that I should get in on the action. I am trying to update some forms and reports, also some minor back end...
3
by: CoopEng | last post by:
Hi all, I've been pouring through hundreds of forums recently and finally decided that I should get in on the action. I am trying to update some forms and reports, also some minor back end...
1
by: jaad | last post by:
I am setting up a multi-users database. The login procedure creates a temporary variable called! which I use throughout the database to filter data the user sees only the data that relates to his or...
9
by: Lysander | last post by:
Multi-Lingual Access Databases Summary. I have been asked many times to produce databases that can be used with different languages, such as English, French, Portuguese, German, Norwegian etc....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.