asp code for upload data

Posted by vicky on Stack Overflow See other posts from Stack Overflow or by vicky
Published on 2010-04-07T05:44:51Z Indexed on 2010/04/07 6:53 UTC
Read the original article Hit count: 279

Filed under:
|
|
|
|

hello everyone i have this code for uploading an excel file and save the data into database.I m not able to write the code for database entry. someone please help

<%
if (Request("FileName") <> "") Then
Dim objUpload, lngLoop
Response.Write(server.MapPath("."))
If Request.TotalBytes > 0 Then
 Set objUpload = New vbsUpload

  For lngLoop = 0 to objUpload.Files.Count - 1
    'If accessing this page annonymously,
    'the internet guest account must have
    'write permission to the path below.
    objUpload.Files.Item(lngLoop).Save "D:\PrismUpdated\prism_latest\Prism\uploadxl\"

 Response.Write "File Uploaded"
 Next

 Dim FSYSObj, folderObj, process_folder
 process_folder = server.MapPath(".") & "\uploadxl"
 set FSYSObj =  server.CreateObject("Scripting.FileSystemObject")
 set folderObj =  FSYSObj.GetFolder(process_folder)

 set filCollection = folderObj.Files

 Dim SQLStr 
 SQLStr = "INSERT ALL INTO TABLENAME "
 for each file in filCollection
   file_name =  file.name 
    path = folderObj & "\" & file_name
    Set objExcel_chk = CreateObject("Excel.Application")
    Set ws1 = objExcel_chk.Workbooks.Open(path).Sheets(1)
     row_cnt = 1


      'for row_cnt = 6 to 7
      ' if ws1.Cells(row_cnt,col_cnt).Value <> "" then
      '  col = col_cnt 
      ' end if
      'next 
      While (ws1.Cells(row_cnt, 1).Value <> "") 
      for col_cnt = 1 to 10     

       SQLStr = SQLStr & "VALUES('" & ws1.Cells(row_cnt, 1).Value & "')"
      next
      row_cnt = row_cnt + 1
      WEnd


     'objExcel_chk.Quit
     objExcel_chk.Workbooks.Close()
     set ws1 = nothing
     objExcel_chk.Quit

     Response.Write(SQLStr)

      'set filobj = FSYSObj.GetFile (sub_fol_path & "\" & file_name)
      'filobj.Delete

    next
End if
End If

plz tell me how to save the following excel data to the oracle databse.any help would be appreciated

© Stack Overflow or respective owner

Related posts about asp

Related posts about excel