Solved

ASP Access 'BULK INSERT'

Posted on 2009-05-17
10
495 Views
Last Modified: 2012-05-07
Dear eXperts
I use ASP with an Access database and would like to make a BULK INSERT
from a text file.
Table: list_emails
2 Fields: id, email

Could y pls give me the code?

Thanks
Manfred
0
Comment
Question by:cosmopolita
  • 5
  • 4
10 Comments
 
LVL 28

Expert Comment

by:chilternPC
Comment Utility
for only 125 points? :-)
do you have the code for inserting one email?
0
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
Limited Members - 125 points is fine, no worries.

Explain a little more detail as to what you want to do.

Carrzkiss
0
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
are you wanting to inserting a lot of emails into a database at one time, in one action?

What is this project going to be used for?
No offense, but this sounds like it could possibly be used for a Spam Email Program?
0
 

Author Comment

by:cosmopolita
Comment Utility
Hola CarrzKiss
I would liekt o insert 20-50 emails.

0
 

Author Comment

by:cosmopolita
Comment Utility
Dear Carrzkiss
No, this is not for Spam.
I have a list of clients and want to keep this list clean.
Adresses are added, deleted, unwanted and not existing taken out etc.
The list will have not more than 500 addresses.
 Yeah, you are right - didn't think about this possibility
Manfred
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 30

Accepted Solution

by:
Wayne Barron earned 125 total points
Comment Utility
code below
Enjoy

Carrzkiss
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

</head>
 

<body>

<%

set conn= Server.CreateObject("ADODB.Connection")

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _

Server.MapPath ("yourdb.mdb") & ";"

conn.open

 

Dim strArray, conn

strArray = Split(Request.Form("MyTextField"), vbCrLf)

Dim arrValue
 

 

For Each arrValue In strArray

   Dim sql

   sql = "INSERT INTO list_emails (email) VALUES ('" & arrValue & "')"

   conn.Execute(sql)

Next

 

conn.Close

%>

<form id="form1" name="form1" method="post" action="Insert.asp">

  <label>

  <textarea name="MyTextField" cols="50" rows="10" id="MyTextField"></textarea>

  </label>

  <label>

  <input type="submit" name="button" id="button" value="Submit" />

  </label>

</form>

</body>

</html>

Open in new window

0
 

Author Closing Comment

by:cosmopolita
Comment Utility
Wow, this worked fine and on the first run :-))
0
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
Yep.
That code is from my KB that I am making for codes.
Another EE helped me the code on here a while back.

Glad you liked it.
Good Luck
Carrzkiss

Author Comments:
Wow, this worked fine and on the first run :-))
0
 

Author Comment

by:cosmopolita
Comment Utility
Dear CarrzKiss
Please, just let me know what KB-Code are and what you make.

Greetings from Spain
Manfred
0
 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
KB = Knowledge Base
I do just about anything with ASP/SQL/Access (SQL Server).
Learning a lot as I go as well.

I do a lot of projects here on EE, and what I do I add to my KB.
I also do Code-For-Hire, for certain projects that are to HUGE to do here on EE.
(There is only so much that you can do for free you know?)

I have been doing ASP for about 5 yrs now, but the last 2 years of really been my best work.

Any thing you want to know about, just ask or check out my profile.

Have a good one.
From the US.
Wayne (Carrzkiss)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now