|
I understand. When I saw the problem, I instinctively thought of 12 and couldn't think of an exception where this would not work, but you are correct, if someone used a decimal, the logic error would recur.
Still coaxing software out of the can after all these years...
|
|
|
|
|
Assuming that Age is an integer, there is absolutely no difference.
In programming, there is almost never one single right answer
|
|
|
|
|
David pointed out the integer issue. I hadn't thought of that. I'll have to check the code and see if it would allow decimal increments, if it would, then perhaps the >=13 would be a better solution for eliminating a potential logic error. I think I'll suggest that it be pointed out in future editions. It can make a big difference.
Still coaxing software out of the can after all these years...
|
|
|
|
|
I've got an implementation of a FTP which ought to work. But when I try to run it through this URL: (b221=my mashine name) "http://b211/FtpBrowser.asp" it sayss that there's too many users on the site at the same time - though it's only me. Sometimes I get an error in the code, too. Why doesn't the site work?
(the code should list the substance of a directory where the user is able to go deeper down the hieracy and back again)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Sub skrivDrev()
set drv = fs.Drives
Response.Write "<IMG SRC=""folder_open.gif"" border=0 align=absmiddle vspace=3>" & f.path & "<br>"
for each d in drv
Response.Write d.Sharename
Response.Write "<a href=""FtpBrowser.asp?sti=" & d.DriveLetter & ":/"">" & d.DriveLetter & "</a> "
next
Response.Write "<a href=""FtpBrowser.asp?sti=" & server.MapPath("/") & """>ROOT</A> "
Response.write "<a href=""FtpBrowser.asp?sti="
if not f.IsRootFolder then
Response.write f.ParentFolder
end If
Response.Write """>[..]</a>"
End Sub
Sub skrivSubFolder()
i = 0
Response.Write "<table border=0 cellpadding=5><tr><td valign=top>"
For Each f1 in fc
if i mod 10 = 0 then
s = s & "</td><td valign=top>"
end If
i = i + 1
s = s & "<a href=""FtpBrowser.asp?sti=" & sti & "\" & f1.name & """><IMG SRC=""folder_closed.gif"" border=0 align=absmiddle vspace=3>" & f1.name & "</a>"
s = s & "<BR>"
Next
i = i - 1
while not i mod 10 = 0
s = s & "</TD><td></td>"
i = i + 1
wend
s = s & "</TR></TABLE>"
Response.write s
End Sub
Sub skrivfiler()
ReDim fileNames(f.files.count)
ReDim fileSize(f.files.count)
ReDim fileType(f.files.count)
ReDim fileDateLastModified(f.files.count)
i = 0
For Each fldr in f.files
fileNames(i) = fldr.name
fileSize(i) = fldr.size
fileType(i) = fldr.Type
fileDateLastModified(i) = fldr.DateLastModified
i = i + 1
Next
response.write "<table bgcolor=c3c3c3><TR class=buttons><td>Name:</TD><TD>Size</TD><TD>LastModified</TD><TD>Type</TD></TR>"
For i = f.files.count - 1 to 0 step -1
response.write "<TR><td bgcolor=FFFFFF>"
response.write fileNames(i) & "</TD>"
response.write "<TD class=buttons>" & fileSize(i) & "</TD>"
response.write "<TD bgcolor=FFFFFF>" & fileDateLastModified(i) & "</TD>"
response.write "<TD bgcolor=FFFFFF>" & fileType(i) & "</TD></TR>"
Next
response.write "</TABLE>"
end sub
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Ftp</title>
<link rel="stylesheet" type="text/css" href="arkiv.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
abc
Testing!-
<%
'if Request.QueryString("sti") > "" then
' sti = Request.QueryString("sti")
'else
' sti = Server.MapPath(".")
'End IF
'Dim fs, f, fc ,sti
'set fs = CreateObject("Scripting.FileSystemObject")
'set f = fs.GetFolder(sti)
'Set fc = f.SubFolders
'skrivDrev
'skrivSubFolder
'Response.Write "</TD></TR></TABLE>"
'Response.Write "<p><table class=beskrivelse style=""font-size: 8px""><tr><TD>"
'skrivfiler
'Response.Write "</TD></TR></TABLE>"
%>
</body>
</html>
|
|
|
|
|
This question really belongs in the ASP.NET forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Are you able to run the code AT ALL? Are you able to run it, say 5-10 times, then it quits? Are you developing this on a 2000 Workstation or an XP machine? If so, you're probably running into the licensed connection limit. You're implementation is not using FTP, you're using the FileSystemObject, which is subject to the limitations of the machine's licensing, 10 connections maximum. Using ASP.NET, when you close the browser, your session (and connection) are still alive, and going to be alive for the next 20-30 minutes (I think), until the session times out on its own. Only then will your connection license be released.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well...it's written in VB code - that's why I placed the question here.
I am able to run the code, but the only thing that gets out of it is the "testing"-string I put in the body-part. I have only put those strings there to debug the code, so I might find the problem myself...but no luck.
I'm using an XP Pro mashine. And I got this part of the code from another place where it (obviously) works fine.
|
|
|
|
|
hmshmsm wrote:
I am able to run the code, but the only thing that gets out of it is the "testing"-string I put in the body-part. I have only put those strings there to debug the code, so I might find the problem myself...but no luck.
You do realize that the code in the BODY tags is completely commented out?
hmshmsm wrote:
I'm using an XP Pro mashine. And I got this part of the code from another place where it (obviously) works fine.
You haven't answered all of my questions. If the comments in the BODY tags are removed, does the code run at all? Does it run about ten times, then quit? Does it not run at all? Does it work after a fresh reboot of the machine, then you try and run this?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
eh...it runs. But the only thing on the screen afterwards is:
abc
Testing!-
|
|
|
|
|
Yes, the body is commented out. I did that to test if the page is working at all. And as the remaining text in the boypart gets out I assume that the page is working.
|
|
|
|
|
In that case, take out the comments. When you load the page, go to View/Source in IE to see what HTML is being generated. You could also put in your own Response.Write("some message:" & somevariable) in places to see where the code is going and what the important variables are. Then just View/Source again to try and trace what's going on.
But, if you get that error again after running it about 10 times, you've run into the licensed connection limit.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I've tried another page now to test the server side:
This is HTML
<%
'This is Visual Basic code
Response.Write "This is Visual Basic code "
%>
<%
If Request.QueryString("id") = "1" Then
Response.Write "The parameter is equal to 1 " & vbNewLine
Else
Response.Write "The parameter is not equal to 1 " & vbNewLine
End If
%>
and the result of this side is:
"
This is HTML
This is Visual Basic code
The parameter is not equal to 1
"
And when I try to reload the page about 15-20 times it still says the same. So I quess that the server is working alright.
But what can be the matter with the first page then?
|
|
|
|
|
Your not getting it. The problem is not that fact that your getting an ASP page from the server. It is that fact that your page is using the FileSystemObject to connect back to the server (not through HTTP) to get its information. THAT is where you connection problem lies...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That's probably true....but the FileSystemObject isn't used the right way then....?
|
|
|
|
|
The FileSystemObject doesn't work over an HTTP connection. There is onlt one way to use the FileSystemObject and your already doing it. The FSO will work using UNC paths (\\server\share\path), and this is where the Server.MapPath function is coming in. It's not returning an HTTP path, it's returning the UNC path. There is no way to get the FSO to work with HTTP.
This uses a licensed connection. Since the workstation versions of Windows (NT Workstation, 2000 Pro, XP) only allow a maximum of 10 simultaneous connections, you'll get this error. This limit will include the HTTP session you started, then each FSO connection is another, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
But why is my code not working then???
|
|
|
|
|
Define "not working"...
The code doesn't run at all and generates that previous error message?
Or the code doesn't generate the HTML you were expecting?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Aparantly the code is running. It's just the output that that doesn't fulfill my criteria. The idea about this page is an FTP in HTML- but the result is far from that.
|
|
|
|
|
Unless the code for generating the drive/folder/file list is generated server-side, you'll have a difficult time getting this to work. ASP.NET with a code behind would be much better at this than a straight ASP page.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Okay - it sounds better, too. Do you by any change have any implementation of that or knows where I can get it? I don't know much about it so far...
|
|
|
|
|
I don't know of any and don't have one myself, but it shouldn't be too hard for you to put one together.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well, probably not. I just don't have any idea of how to do it myself...(?)
|
|
|
|
|
and when I type the URL "http://b211/test.asp?id=1" the result is:
This is HTML
This is Visual Basic code
The parameter is equal to 1
|
|
|
|
|
Hi there,
Can anybody tell me how to change the column's color in DataGrid ?
I have tried, but didn't work.
Here below is my code.
There is an error at line ##. The error message is :
"An unhandled exception of type 'System.NullReferenceException' occurred in Badminton.exe
Additional information: Object reference not set to an instance of an object."
Thanks for help.
My code:
==================
Private Sub frmGridDisplay_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
DbDA_Bad.Fill(DS_Bad)
Dim TS_Bad As New DataGridTableStyle
With TS_Bad
.MappingName = "Collection"
.HeaderBackColor = Color.YellowGreen
.HeaderForeColor = Color.Green
.HeaderFont = New Font("Microsoft Sans Serif", 10.0!,
FontStyle.Bold, GraphicsUnit.Point, CType(0, Byte))
End With
Dim kl_code As New DataGridTextBoxColumn
kl_code.MappingName = "bt_code"
kl_code.HeaderText = "Code"
kl_code.Width = 60
'====These two lines didn't work. There an erro :
## kl_code.DataGridTableStyle.BackColor = kl_color.YellowGreen
kl_code.DataGridTableStyle.ForeColor = kl_color.Tomato
Dim kl_m1event As New DataGridTextBoxColumn
kl_m1event.MappingName = "bt_m1event"
kl_m1event.HeaderText = "Event"
kl_m1event.Width = 175
TS_Bad.GridColumnStyles.AddRange(New DataGridColumnStyle() _
{kl_code, kl_m1event})
DGBad.TableStyles.Add(TS_Bad)
End Sub
|
|
|
|
|
'====These two lines didn't work. There an erro :
## kl_code.DataGridTableStyle.BackColor = kl_color.YellowGreen
kl_code.DataGridTableStyle.ForeColor = kl_color.Tomato
I hope you defined YellowGreen and Tomato in your kl_color class. Aren't those supposed to be:
'====These two lines didn't work. There an erro :
kl_code.DataGridTableStyle.BackColor = Color.YellowGreen
kl_code.DataGridTableStyle.ForeColor = Color.Tomato
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|