Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Read from text area
Hi

I have a database on a website, and a table in this db contains two fields,
PCode, and Verified.  I have to add new records to this in batches, and
these batches are generated on a local PC.

Is it possible to paste the contents of a text file into a text area form
field, and then run an asp/vbscript routine to update the database.

The text file contents to be pasted would be in the format:

1234, Y
1235, N
1236, Y

I am ok with updating the database, what I would like to know is how to
split the text into individual items - is there some kind of read line
function.

Thanks



Report this thread to moderator Post Follow-up to this message
Old Post
Mark Fisher
12-23-04 08:55 PM


Re: Read from text area
You will probably have to read it in as a string, then use Split() on the
VbCrLf (line break), to get it into an array. Then loop the array and split
on the "," to get the two values....

fun fun... :]

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"Mark Fisher" <mfisher@uku.co.uk> wrote in message
news:KxDyd.1466$8j6.858@newsfe6-win.ntli.net...
> Hi
>
> I have a database on a website, and a table in this db contains two
> fields, PCode, and Verified.  I have to add new records to this in
> batches, and these batches are generated on a local PC.
>
> Is it possible to paste the contents of a text file into a text area form
> field, and then run an asp/vbscript routine to update the database.
>
> The text file contents to be pasted would be in the format:
>
> 1234, Y
> 1235, N
> 1236, Y
>
> I am ok with updating the database, what I would like to know is how to
> split the text into individual items - is there some kind of read line
> function.
>
> Thanks
>
>



Report this thread to moderator Post Follow-up to this message
Old Post
Curt_C [MVP]
12-23-04 08:55 PM


Re: Read from text area
"Mark Fisher" <mfisher@uku.co.uk> wrote in
news:KxDyd.1466$8j6.858@newsfe6-win.ntli.net:

> Is it possible to paste the contents of a text file into a text area
> form field, and then run an asp/vbscript routine to update the
> database.

Set Cn = Server.CreateObject("ADODB.Connection")
Cn.ConnectionString = "[...]"
RowArray = Split(Request.Form("MyTextBox"),vbcrlf)
For Each Item In RowArray
Cn.Execute "Insert Into MyTable (Field1, Field2) Values '" & Trim(Split
(Item,",")(0)) & "', '" & Trim(Split(Item,",")(1)) & "'"
Next
Set Cn = Nothing

Untested code, but it should work for you.

Report this thread to moderator Post Follow-up to this message
Old Post
Scott McNair
12-24-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

ASP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 08:15 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.