Current location: Hot Scripts Forums » Programming Languages » ASP » insert into SQL database


insert into SQL database

Reply
  #1 (permalink)  
Old 07-23-03, 04:19 AM
Dahquim Dahquim is offline
New Member
 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
insert into SQL database

Hello.

I can program quite well in ASP/ASP.net, but was wanting to ask a question regarding something i need to do.

Each moneth we produce a file for a customer, e.g. 123001_33.csv. and i want a ASP/ASP.net page that will load this file into a SQL server database, using the first 6 characters of the file as the userID.

Does anyone have any hints, ideas, or have done this before and could let me have the code.

Thanks a lot

Dahquim
Reply With Quote
  #2 (permalink)  
Old 07-27-03, 07:34 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Re: insert into SQL database

Quote:
Originally posted by Dahquim
Hello.

I can program quite well in ASP/ASP.net, but was wanting to ask a question regarding something i need to do.

Each moneth we produce a file for a customer, e.g. 123001_33.csv. and i want a ASP/ASP.net page that will load this file into a SQL server database, using the first 6 characters of the file as the userID.

Does anyone have any hints, ideas, or have done this before and could let me have the code.

Thanks a lot

Dahquim
First, open the file. Pull off the name. Use the Mid function to grab the first 6 characters..

Code:
Dim strChars
strChars = Mid(strFileName,1,6)
Now, since a CSV file is just text, you can take the contents of the entire file after reading it into a variable, and use the Split function to split it by vbcrlf.

This will create an array that holds each line in a different space.

Loop through that array and split each value by a comma (this will get you every value). This will create yet another array of values. Loop through that array and generate your SQL statement.
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL database registration form help vinhkhuong PHP 3 10-10-03 03:49 AM
ASP Calendar..HELP...pls jimthepict ASP 1 07-31-03 05:01 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM
Share database over the internet nitinkedia PHP 0 07-11-03 12:22 AM
Share database over the Internet nitinkedia New Members & Introductions 1 07-10-03 02:50 PM


All times are GMT -5. The time now is 02:58 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.