Hello Friends
Please help me out it's urgent.
I have a problem in Uploading a excel file on the web and then insert data from that excel file in to the sql server 2005 database.
The following error coming when i uploading the excel file.
While i have checked my code please review the code i given below the error code
Please help me out it's urgent.
______This is the Error Coming__________
Active Server Pages error 'ASP 0113'
Script timed out
/CapitelAdminControl/dashboard/Product/process2.asp
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.
____________________________________
_________This is the code of the page___________
<!--#include virtual="config.asp" -->
<%
'Server.ScriptTimeout = 360
dim objUpload
set objUpload = Server.CreateObject("Persits.Upload.1")
objUpload.OverwriteFiles = false
objUpload.Save "D:\WEBDATA\130.13\capitel.in\images\"
'objUpload.Save= "..\..\..\images\"
set File=objUpload.Files("File")
ExcelFileName=File.ExtractFileName
'connection to the Excel File
set getConExcel=server.CreateObject("ADODB.Connection")
'conStrExcel="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\website\capitel.in\images\" & ExcelFileName & ";Extended Properties=""Excel 8.0;HDR=Yes"""
conStrExcel="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\WEBDATA\130.13\capitel.in\images\" & ExcelFileName & ";Extended Properties=""Excel 8.0;HDR=Yes"""
getConExcel.Open conStrExcel
Set objRS_Excel = Server.CreateObject("ADODB.Recordset")
getCon=Application("connectionObject")
Set objRS_Database = Server.CreateObject("ADODB.Recordset")
myExcelQuery="Select * from MyData"
objRS_Excel.Open myExcelQuery,getConExcel,3,3
'if data found in the excel sheet Read the Excel Sheet and then
'insert these data into the database
if not objRS_Excel.eof then
totalRecords=0
'objRS_Excel.MoveFirst
While Not objRS_Excel.EOF
objRS_Database.open "tbl_product",getCon,1,2
with objRS_Database
.addNew
For X = 0 To objRS_Excel.Fields.Count - 1
.fields(X+1)=objRS_Excel.Fields.Item(X).Value
Next
.updatebatch
end with
objRS_Database.close
totalRecords=totalRecords + 1
objRS_Excel.MoveNext
Wend
end if
'free the memory
Set getConExcel = Nothing
Set getConDatabase = Nothing
Set objRS_Excel = Nothing
Set objRS_Database = Nothing
'end block
'now delete the excel file that is uploaded by the client after data insersion
set DelUpload=server.CreateObject("Persits.Upload.1")
dim ExcelFilePath
ExcelFilePath="D:\WEBDATA\130.13\capitel.in\images\" & ExcelFileName
'ExcelFilePath="D:\website\capitel.in\images\" & ExcelFileName
if DelUpload.FileExists(ExcelFilePath) then DelUpload.DeleteFile ExcelFilePath
'end block
%>
<script language="javascript">
alert("Excel Data Upload Successfully ");
document.location.href="../index.htm";
</script>
__________________________________________________
Please find out the exact error . . .
Yogesh Chandra Upreti
Sr. Associate Technology
Magnon Solutions Pvt. Ltd.,Delhi