What is the most efficient way of inserting multiple records into a database ? At the moment, I'm grabbing data and inserting each record with a loop. The only thing is on each loop I'm opening a connection to the db (SQL Server), inserting a record, then closing it.
Is there a way of inserting all the data with either one command or by keeping the connection and looping the command instead. The situation is the user entering email addresses into a textarea, one per line, then process each of those emails as a record.
I am trying to figure out a way to insert all the records from a dynamic table - repeat region into one table as individual records. On the 1st page users select which items they want from a large list. When they click submit it passes the values ( IDs ) with a URL par to the next form. This form has a recordset that uses the URL par from the last page and creates a new dynamic table - repeat regon with all the records they chose. I need to do this so I can then add up rates for those selected items. I need to find a way to the add all those selected records now into one table. Also I need to have them insert each record at a time. So if 4 records are in the recordset and repeat region, I need to have it add 4 records into the table. Hope that makes since. Im a bit lost on this one.
Is it possible when you insert a record in a database to only insert max 5 records. Can i make it delete the oldest one when i want to insert record #6 and so on?
Anyone know if it is possible to update/insert a database record into a dynamically specified field.
The code I have here holds data in an asp session, ownerId, storeid and product type.
I can insert a record into the Productcat table, fields OwnerId and surfboards, no problem. But what I would like is to insert the ownerid then insert poduct type into the field sepcified in the session variable (session("prodtype")) and/or strprodtpye
For Example Insert OwnerId + product type into productcat into fileds ownerId and field labled ''strprodtype'' (variable, surfboard, wetsuit, boots, etc)
SQLstatement = "INSERT INTO Productcat (Ownerid,'"&strprodtype&"') "
I have tried using different methods, but the closest I got was IIS error msg ='field not found ("Surfboards", "wetsuits", "boots", etc)' Code:
I'm trying to set up a form whereby users can select a variety of different subject mailing lists they'd like to be added to. Each subject is in a different table so I want the FROM part of my SQL statement to loop through the values selected from the list box which I've loaded into an array. But I'm getting a Type mismatch error.Code:
I am workin on a project at home,asp vbscript website, n im having problems with inserting records into my database .. I am using a dsn-less ADODB connection, but it seems that some kind of security is preventing me from writing in the db.. i can access n retrieve, but NOT WRITE.. ive tried disabling every type of security, still doesnt work..
I have a recordset that contains multiple records of product a user is purchasing. For clarity, I converted the recordset fields to variables. I need to take that entire recordset and insert it into another table on a remote server. The below code only inserts 1 record. How do I change the code to get all records inserted?
I get this following error while inserting recoed in ms-acces db :
Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) [Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only. /mis/add_iteminfo.asp, line 35
This thing is making me go crazy as i'm running windows platform & running the app on localhost. The have several times but the db isn't read-only, not even in the iis. Don't know what to do .
i have learned database connectivity. I am facing some problems in inserting records to database using SQL. Please tell me the way to insert records using SQL. I received error about wrong arguments on following line.
where Rs is the RecordSet object, Query contains they SQL String, and DBConn is the Connection to my Microsoft Access database. I easily connected to the database and retrieved records using following command:
how to insert multiple records in database?? i have this problem like i have this one form and there are three fields like the (quantity,unit,item name)..the item that will be inputted will vary, depending on the number of item to be inputted..
Ex. enter the number of item: 3 qty unit item_name 1. 2 pcs pencil 2. 2 pcs glue stick 3. 2 pcs clip (SUMBIT)
what should i do in order that these items will be inserted in just one insert statement?
I have a project where i have to use an html asp application form to insert records into an sql database. My problem is finding resources online to practice with to learn, i have basic knowledge of ASP and have attended the microsoft 1 week course on Administering a 2000 SQL Database and i have designed a few small sites so i know html and javascript. I have the database side covered its just the VB code to take the form values and post them to the sql database.
I was wondering if anyone could point me in the right direction of sample codes to play around with as i cant seem to find any which relate to this project.
Does anyone know how to insert multiple records in the same table at the same time. This is what I have. I have a form with 6 fields and they are name prod1 through to prod 6. The table is called related products.
Basically this table is related to the main table called prod_parent. tried looking on google and couldn't find anything.
I'm trying to insert records into an SQL database coming from a page using the request ..form method. The table "general" has a primary key 'geid .' I get the following error:
Cannot insert the value NULL into column 'geid', table 'general';
column does not allow nulls. INSERT fails.
....not sure how to include the 'geid' field into the scheme.
I have an .asp page with a form to copy job responsibilites form one job to another. It is a hotmail type interface with checkboxes besides each responsibility. After submitting, it should copy the selected resp's to a different job. After that it should renumber that job's responsibilities.
This is the code I am using now to copy:
copySQL4 = "INSERT INTO jambue.RESP(POSCODE,IDCODE1,IDCODE2,RESP_NUM,RESP) SELECT '" & id & "' POSCODE,'" & dept & "' IDCODE1,'" & unit & "' IDCODE2, '999' RESP_NUM, RESP FROM jambue.RESP WHERE (POSCODE = '" & POSCODE & "' AND IDCODE1 = '" & sourceDept & "' AND IDCODE2 = '" & sourceUnit & "') AND RESP_NUM IN (" & Request.Form("chk") & ")"
As you can see the value '999' is hardcoded in there as the new Responsibility Number to go with the copied responsibility. I use this because there are no jobs with that many responsibilities. This works fine if I only select one resp. to copy over. But if I select more than one that part still runs fine but I get an error with the below. It says too many rows would be affected. Of course, this must be because there are now at least 2 responsibilites with the same RESP_NUM. Code:
I'm trying to insert mutiple records into my database when the form is submitted.. My form has 4 textfields; serial1, price1, serial2 and price2.
I would like to insert serial1 and price1 as one record, then serial2 and price2 as the second record. I know some sort of loop has to be used to achieve this but i'm new to this and I don't know what to do...
I tried to do it with dreamweaver but it does not seem possible and the dreamweaver code seems really complicated I've only been able to insert only the first row(serial1,price1).. since I only have 2 fixed rows I guess what I need to do is to get dreamweaver to do it twice in a loop. Code:
I have a table that contains all of the function permissions within a given application. These functions are different sections of a site and each has its own permissions (READ, WRITE, UPDATE, DELETE) which are controlled by a web frontend and the table records are manipulated to control the permissions. Code:
The problem concerns 2 tables, cart_products and cart_shoppingcart.
Cart_products contains all the product data (eg, prices, product's key name, etc), but most importantly, it contains the quantity of stock (prod_quantity) for each item.
cart_shoppingcart contains all of the user's items in their shoppingcart, including those that are part of an (customer) order; these have the order_number to differentiate from those that aren't in any order (their Order_number is 'no_order', the others have the order number).
Now, what I want to do is this:
For every item in the order (ie, every entry in cart_shoppingcart that matches the username and order number), take the quantity (x) the customer is ordering, then take the quantity of stock remaining (y), then subtract x from y to create the new stock level (z) and update the appropriate record in cart_products with z (all this with SQl preferably).
I was thinking of using a Do while loop, but realised that it wouldn't work as I'd have to use several SQL statements and then I'd run into a problem the minute ASP reads "objrec.movenext".
I'm trying to pull the last 5 records from my database.
<% j=5 rs.MoveLast While ((j>0) AND (NOT rs_article.BOF))%> ''Execute HTML and data insertion here
<%rs_article.MovePrevious j=j-1 Wend%>
Everytime I attempt to run this code, I recieve an HTTP 500- Internal Server Error. It tells me no more than that. I know that my connection settings are OK because when I move forward through the database (first five records), the code executes without error. And yes, my Cursor type is Dynamic.
Alternatively, I would also like to know how to add new recordset to the beginning of a database rather than the end.
I have an Access database with two fields that I would like to group by. The two fields are location and department. Field names are "Location" and "DeptName".
I have the code correct for grouping by location. That code looks like this: Code:
Our graphic designer has just finished redeveloping our website. On the site, we use SSL to secure the area where a user enters their personal information to order items from us. (we do not do many transactions - maybe 1 per day...) We are a log home mfg company so they would only order plan books, maybe a video etc...
When the user clicks "Submit Order", we want to encrypt each data item (because of new legislation governing customer personal info etc...) and write a record to an access db. From here it will be imported into our Customer DB leads database...
I do not use ASP but program in VB 6 and Access 2000. ASP looks similiar in many ways...
Does someone have a good ASP script for encrypting data? And, if so, is it fairly strong encryption?
Also, is there any trick to writing an "insert" SQL script in ASP or is it exactly the same as I would do in VB or Access? Maybe someone has an "insert" script handy they could pass along including the command to actually execute it?
that's shortly the way i'm inserting new records. using mysql and asp functions.
The prob is that inserting only one record every time. if i got data for 3 records how can i make it at once to add 3 new records in some given order into the db
What is the best way to see if a record has inserted correctly into the datase in ASP? Also, how to tell the user what the error is. I am inserting like this with the ADO command object: Dim sInsert, objCmd set objCmd = Server.CreateObject("ADODB.Command") sInsert = "sp_ADS_Insert_Driver_General_Data " on error resume next With objCmd .ActiveConnection = oConnEnergy .CommandText = sInsert .CommandType = adCmdStoredProc .Execute , , adExecuteNoRecords
Application X has three screens. The user captures information on screen one and then clicks a navigation button to go onto screen two.He does the same on screen three. At the bottom of screen three is a submit button. When this button is clicked the system does some calculations with the information that is supplied and then uploads all the info that was captured on the screens to the database.
Should the data be uploaded to the database all on one go when the user clicks the submit button or should it be uploaded after each screen - ie when the user clicks the button on Screen 1 the data is uploaded to the database and then screen two is displayed.
I have a column call UserDate and it's properties are this : varchar(50) . I have a function which updates the column with todays date. for some reason, if I manualy give the value to be inserted a value of '10/10/2006' or use date() it inserts a value of 0 if I give a value of 4 to be inserted it works?
I have been working on a project for 2 days and this is the last piece to get it to work, can anyone point out where I'm going wrong. P.S I have tried giving the colum a date format but unfotunately the format is american and I need it in english to compare with something else I'm working on.