Here is what I use to allow clients to run imports of
new items in SQL from a .csv file:

'Create our FSO.
set objFSO =
Server.CreateObject("scripting.FileSystemObject") 

'Set the path to the error log file.
strPath = server.MapPath("NewItems") &
"\NewFCIItems.csv"

'Check to make sure the file exists before we process.
if objFSO.FileExists(strPath) then

'Get the text file that we will be reading.
set myFile = objFSO.GetFile (strPath)

'Open the text file.
set objTextFile = myFile.OpenAsTextStream(ForReading,
-2)

'Loop thru the text file and get all the text, assign
to variable.
Do While not objTextFile.AtEndOfStream 

'Grab each line in the file, store in variable.
strText = objTextFile.ReadLine

'Evalute the line to see if data exists.
if len(trim(strText)) > 0 then

'This is the code that extracts the items from the
line.
Dim strMyArray, intMaxIndex, intCurrIndex,
strCurrValue
      
'Parse the string passed in, sperating by commas ",".
strMyArray = split(strString, ",")
      
'Find out how many fields we parsed.
intMaxIndex = UBound(strMyArray)
      

'Make sure we have all the required fields.
if intMaxIndex = 3 then
'Parse out the values from the string passed in.
strVar1 = strMyArray(0)
strVar2 = strMyArray(1)
strVar3 = strMyArray(2)
end if

'The file is not blank, process.
strInsertSuccessful = InsertNewItem(strVar1, strVar2,
strVar3)

'Check the response from the insert above and set err
if found.

End If

Loop

End If

'Close & destroy the file.
objTextFile.close
set objTextFile = nothing

Mark

--- goriojuan <[EMAIL PROTECTED]> wrote:

> Aside from using DTS and Export wizard, how can we
> export data from 
> Excel to SQL Server2000 database. What is the exact
> script used to do 
> this. Help is highly appreciated.
> 
> 
> 



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to