Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Textfield - Multi Field insert

Hello All;

  Got something that i have been wondering how to do for several years now.
(When it comes to me, I think about how it could be done)

Textfield.
have it to where each line does a break. (String)
And then you look at each break in the textfield, to determin how many strings you have.
You then have an INSERT Statement that will insert each line (String) into indivisual fields.
(Multi Field insert statement)

So.
To break it down.
Take a continues string from a Textfield
Break it down to indivisual strings (Per row)
And insert indivisual records into a Table.

Hope that it is clear.
Just something that I have been wondering about for a while.
What made me thing about it was that I have an Old Perl script
That uses a Textfield and for each row, it inserts into the MySQL database.
So.
If it can be done in Perl/MySQL
It should be able to be done in ASP/Access (or) (SQL Server)
(I am using Access)

have a good one all.
Carrzkiss
Avatar of aibusinesssolutions
aibusinesssolutions
Flag of United States of America image

Do you mean line by line? I would just split the string by vbCrLf.

strArray = Split(txtBoxText, vbCrLf)

That will put the values into an array, so
strArray(0) = first line
strArray(1) = second line
etc.

Then just loop throw the array and insert each string.
Avatar of Wayne Barron

ASKER

OK.
I have read something about this before.
Would you have some resources on this, or possibly could you make up a souce example?

Thanks AI
You are actually the first person that has said that it is possible.
The last time that I posted this same topic years ago, I was told that
You could not take a continues string and split it.
ASKER CERTIFIED SOLUTION
Avatar of aibusinesssolutions
aibusinesssolutions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
strange.
I am getting this error

Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/Test/EE/Q_24163759/Insert.asp, line 16, column 13
Dim strArray = Split(Request.Form("MyTextField"), vbCrLf)
------------^
Oh, I'm thinking in asp.net, just split it into two lines.

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

I have thought about venturing into ASP.NET
But I am just know getting to where I can do a lot of things in ASP Classic.
So, I will wait until there is something that I want to do, that can only be done in .NET.
I'll be darn.

Worked like a charm.
You did what others said could not be done.
That was so simple. You have just done something that I have wanted to do for years in ASP.
Proven that ASP is just as powerful as PERL

Thank you so very, very much.

Wayne
You Rock BIG TIME.