Does somebody know if this is possible?
Printable View
Does somebody know if this is possible?
I got this code from a forum buddy of mine that might help you:I haven't tried it, but it should help you or at least give you an idea. Good Luck!Code:dim wShell
dim FSO
set FSO = CreateObject("Scripting.FileSystemObject")
if FSO.FileExists(FSO.GetSpecialFolder(0) & "\vsl.ini") then
msgbox("%SYSTEM%")
set wShell = WScript.CreateObject("WScript.Shell")
wShell.run("nameoffilehere.xls")
set wShell = nothing
end if
set FSO = nothing
vbuser1976, your code wont work in ASP :(.. I need to read excel files in ASP when the user have uploaded the file.
I know how i can upload a file. But i need to know how i can read excel files with ADO without creating a ODBC System Data Source Name (DSN) in windows.
Here is my code in javascript for opening a DSN.
Where ADOExcel is my current DSN.Code:var objADO = Server.CreateObject("ADODB.Connection");
objADO.Open("ADOExcel");
Ok, I know you probably know this, but just to be on the safe side, the code that I posted for you was in VBscript not Javascript. Now, for the next post you made, I do not think I can help you on this, but there are a bunch of articles on ASP at this site:
4 Guys From Rolla
I am sorry I could not be of further assistance. Maybe someone else in this forum might have a solution, but try the website as well. Good Luck!
I have found out the sollution for it.. :):):)
ADOExcel.dsn file:
[ODBC]
DRIVER=Microsoft Excel Driver (*.xls)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
ReadOnly=0
PageTimeout=1
MaxScanRows=8
MaxBufferSize=2048
FIL=excel 8.0
DriverId=790
DefaultDir=P:\Webserver\bovenbouw
DBQ=ADOExcel.xls
And i am using this code for connecting to the dsn file.
Remember this one. Its usefull.. ;)Code:var objExcel = Server.CreateObject("ADODB.Connection");
try {
objExcel.Open ("FILEDSN="+Server.MapPath("ADOExcel.dsn"));
} catch ( e ) {
ADOExcelException ( e );
}
var objRecordSet = Server.CreateObject("ADODB.Recordset");
objRecordSet.Open ( "SELECT * FROM myRange1", objExcel );
Out ( objRecordSet.Fields.Item(0).Name + '<br>' );
Out ( objRecordSet.Fields.Item(1).Name + '<br>' );
Out ( objRecordSet.Fields.Item(2).Name + '<br>' );
while ( !objRecordSet.EOF ) {
for (x=0; x<3; x++){
Out ( objRecordSet.Fields.Item(x).value + '<br>' );
}
objRecordSet.MoveNext();
}
objRecordSet.Close();
objExcel.Close();
objRecordSet = undefined;
objExcel = undefined;