Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - whats wrong in this script ??
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

whats wrong in this script ??

 Post Reply Post Reply Page  12>
Author
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Topic: whats wrong in this script ??
    Posted: 16 June 2003 at 10:34am

see this site http://www.javacoder.dk:56400/fileupload/sizecount2.asp

I have 3 sites and 1 database in the database I have a tabel FilStr

On my sizecount.asp
<%
Dim aUnits, nUnit
aUnits = Array("B", "kB", "MB", "GB", "TB")
nUnit = 0
Do Until (nSize <= 1024) OR (nUnit = UBound(aUnits))
  nSize = nSize / 1024
  nUnit = nUnit + 1
Loop
FormatSize = FormatNumber(nSize, 2) & " " & aUnits(nUnit)
End Function
%>

This site will give me a right sizetype !!!


my db.asp
<%
Dim sConnectionString, oConnection, oRecordset, intTotalSize
sConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath ("FileDB.mdb")
Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open sConnectionString
Set oRecordset = Server.CreateObject("ADODB.Recordset")
oRecordset.Open "SELECT Sum([FilStr]) FROM [files]", oConnection, 1, 1
intTotalSize = FormatSize(oRecordset.Fields(0).Value)
oRecordset.Close
Set oRecordset = Nothing
%>

This site will give me a sum of all the numbers in FilStr !!


My Sizecount2.asp site:
<!-- #include file="db.asp" -->
<!-- #INCLUDE FILE="sizecount.asp" -->
<html>
<head>
<body>
<%
Response.Write "<b><font face=Tahoma size=2>" & FormatSize(intTotalSize) & "</font></b><font face=Tahoma size=2>&nbsp;Total Filesize</font><br>"
%>
</body>
</head>
</html>

This site shut show me a file size number !!

but i get an error can someone help me to make this script working !??

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 1:45pm

"i get an error"

and the error would be?

Contribute to the working anarchy we fondly call the Internet
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 4:02pm

tjek the link !!

but it's something about the End Function code

Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 16 June 2003 at 4:15pm
On the first chunk of code you have an End Function, but wheres the start of it?
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2003 at 1:42pm

MorningZ or Gullanian

Will U help me to get the code right so it will work ?? Pleas !!!

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2003 at 2:05pm
As it appears to be a function (the top script) there is the declaration of the function missing. Try something like
<%
Function (nSize)
Dim aUnits, nUnit
aUnits = Array("B", "kB", "MB", "GB", "TB")
nUnit = 0
Do Until (nSize <= 1024) OR (nUnit = UBound(aUnits))
  nSize = nSize / 1024
  nUnit = nUnit + 1
Loop
FormatSize = FormatNumber(nSize, 2) & " " & aUnits(nUnit)
End Function
%>
I used nsize as it was the only value not dimmed so might not be right, see where you got the script from, what is missing.


Edited by michael
Back to Top
aero View Drop Down
Groupie
Groupie
Avatar

Joined: 21 May 2003
Location: Denmark
Status: Offline
Points: 80
Post Options Post Options   Thanks (0) Thanks(0)   Quote aero Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2003 at 2:31pm

then I get a new error !!!

try to se the link !!

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 17 June 2003 at 2:37pm
I see the link but do not speak your language. Put some effort in it.
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.