asp代码上传数据

我有这个代码上传一个Excel文件,并将数据保存到数据库。我不能写入数据库input的代码。 有人请帮忙

<% 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告诉我如何将以下Excel数据保存到Oracle数据库。任何帮助将不胜感激

你想要做的基本想法是:

从电子表格中逐行取出数据,并为每一行执行一条insert语句到数据库。 您可能无需insert all您正在尝试使用的语法。

你的SQL应该是这样的格式:
insert into <tablename> (<column_name1>, <column_name2>) values (<value1>, <value2>)

您的代码正在尝试为SQL语句生成string,但不会执行插入操作。 你应该把它分解并输出你正在生成的SQLstring,以确保它是正确的。

以下是在经典ASP中插入到Oracle数据库的示例:
http://home.wlv.ac.uk/~cm1958/TextVersion/OracleASP/InsertingData.html

它引用了一个getDBConnection函数,您必须更改为使用连接string作为数据库的代码并创build一个连接对象。