473,671 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

split array twice and do a multiple insert

Here is the code:

<%
dim testArray, testArray2
dim Conn, rs
dim sSQL, sConnString
'response.write request.form("s el1")
'testArray = split(request.f orm("sel1"),"," )
'for each gidstuff In testArray
'Response.Write gidstuff & "<br />"
'next
'define the connection string, specify database
sConnString="wh atever_it_is"
'create an ADO connection and recordset
Set Conn = Server.CreateOb ject("ADODB.Con nection")
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
'Open the conn
Conn.Open sConnString
testArray = split(request.f orm("sel1"),"," )
For i = lbound(testArra y) to ubound(testArra y)
'second split
aSplitArray = split(testArray (i),"$")
'response.write "GID:" & aSplitArray(0) &" STOREID:" & aSplitArray(1) &
"<br>"
sSQL="insert into group_editor_lo g (storeid, oldgid, newgid, stamp,
eventid, valid) select '" & _
aSplitArray(1) & "', '" & aSplitArray(0) & "', '" & 1 & "', '" & date()
& "', '" & 1 & "', '" & 1 & "'"
response.write sSQL & "<br>"
Conn.execute(sS QL)
Next
response.end()
'sSQL="insert into group_editor_lo g (storeid, oldgid, newgid, stamp,
eventid, valid) select '" & _
'aSplitArray(1) & "', '" & aSplitArray(0) & "', '" & 1 & "', '" &
date() & "', '" & 1 & "', '" & 1 & "'"
%>

I am grabbing multiple select list items and splitting them twice,
reason for this is that I am carrying over 2 values from the select
list.

My problem is this when I am doing a multiple insert the records are
duplicated, in other words, if I select 3 it inserts 6 six, I can't
figure out how to insert the exact amount of records that are selected.

Please help!

Dec 20 '06 #1
1 4821

<cl**********@y ahoo.comwrote in message
news:11******** **************@ 80g2000cwy.goog legroups.com...
Here is the code:

<%
dim testArray, testArray2
dim Conn, rs
dim sSQL, sConnString
'response.write request.form("s el1")
'testArray = split(request.f orm("sel1"),"," )
'for each gidstuff In testArray
'Response.Write gidstuff & "<br />"
'next
'define the connection string, specify database
sConnString="wh atever_it_is"
'create an ADO connection and recordset
Set Conn = Server.CreateOb ject("ADODB.Con nection")
Set rs = Server.CreateOb ject("ADODB.Rec ordset")
'Open the conn
Conn.Open sConnString
testArray = split(request.f orm("sel1"),"," )
For i = lbound(testArra y) to ubound(testArra y)

since you have one insert for each item in your array, you must have 6 items
not 3 in your array

write it to screen and see

'second split
aSplitArray = split(testArray (i),"$")
'response.write "GID:" & aSplitArray(0) &" STOREID:" & aSplitArray(1) &
"<br>"
sSQL="insert into group_editor_lo g (storeid, oldgid, newgid, stamp,
eventid, valid) select '" & _
aSplitArray(1) & "', '" & aSplitArray(0) & "', '" & 1 & "', '" & date()
& "', '" & 1 & "', '" & 1 & "'"
response.write sSQL & "<br>"
Conn.execute(sS QL)
Next
response.end()

Why is the insert repeated here?
'sSQL="insert into group_editor_lo g (storeid, oldgid, newgid, stamp,
eventid, valid) select '" & _
'aSplitArray(1) & "', '" & aSplitArray(0) & "', '" & 1 & "', '" &
date() & "', '" & 1 & "', '" & 1 & "'"
%>

I am grabbing multiple select list items and splitting them twice,
reason for this is that I am carrying over 2 values from the select
list.

My problem is this when I am doing a multiple insert the records are
duplicated, in other words, if I select 3 it inserts 6 six, I can't
figure out how to insert the exact amount of records that are selected.

Please help!

Dec 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4894
by: nieuws | last post by:
Hi, I was trying to do the following. It's my first php "project", so it's quiet logic that i have some problems. Perhaps the php community might help. It's about this : I have a txt file with the following data : 1. Stijn Piot 58.12; 2. Kim Van Rooy 1.25; 3. Johnny Marcovich 2.37; 4. John Terlaeken (Bel) 1 ronde/tour; 5. Michael Bertrand 2.12;
5
31173
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it will split myString up using the delimiter of 1 space so that
19
10912
by: David Logan | last post by:
We need an additional function in the String class. We need the ability to suppress empty fields, so that we can more effectively parse. Right now, multiple whitespace characters create multiple empty strings in the resulting string array.
3
3228
by: Jan Hanssen | last post by:
Hi! I have a list of data in a textfile which is tab delimited. Each line is seperated by a VbCrLf. I want to collect this data in a multidimensional string array. I do not wish to use a database or a Disconnected ADO Recordset since this is just passing data along to be written into an XML file... I've figured out how to split the data line by line by doing a
3
9656
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3... field1...field2...field3...
9
2187
by: MrHelpMe | last post by:
Hello again experts, I have successfully pulled data from an LDAP server and now what I want to do is drop the data into a database table. The following is my code that will insert the data but that has problems. FullName=Request.Form("Name") Email=Request.Form("Email") GivenName=Request.Form("GivenName")
11
5064
by: Brian | last post by:
I have been working on a data reception system.. I am still finding my way around Javascript, though I am accomplishing much. I just fixed a flaw that was really hard to find. The symptoms are this: I get a multiline string returned to Javascript from a Proxy+Google Maps API GDownloadUrl() The data, when added to a DOM table looked fine, about 20 lines in CSV format
2
1337
by: sicario | last post by:
Hi, givens lines of text such as: the cat sat on the mat the <var> sat on the mat the <var> sat on the <my object> the <var> sat on the <my object> and <action taken by cat> I want to be able to return all instances of my variables (anything within <>). Sometimes the variable will be one word only (i.e <var>, but it may be several (i.e <action taken by cat>)
35
5875
by: Lee Crabtree | last post by:
This seems inconsistent and more than a little bizarre. Array.Clear sets all elements of the array to their default values (0, null, whatever), whereas List<>.Clear removes all items from the list. That part makes a reasonable amount of sense, as you can't actually take items away from an Array. However, there doesn't seem to be a way to perform the same operation in one fell swoop on a List<>. For example:
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.