Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 invalid type?

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-01-22 : 13:21:32
Anyone? I really need to resolve this issue.
Basically I have my scripts inside folder
of path:
\\raptor\www\spi\scripts

Now the asp page that calls one of these scripts resides in:
\\raptor\www\spi\bugs

So my include looks like this:
<!--#include virtual="/spi/scripts/functions.asp"-->

Is that even right?

I dont see a problem with the way I call the function ValidateDate this is just a SNIPPET of code from the asp file that resides in the \\raptor\www\spi\bugs path:

<%
<!--#include virtual="/spi/scripts/functions.asp"-->
do until rs.eof
%>
<tr>
<td width="112"><center><% Response.write(rs("Name")) %></center></td>
<td width="425"><center><% Response.write(rs("Description")) %></center></td>
<td width="143"><center><% Response.write(ValidateDate(rs("DateRecorded"))) %></center></td>
<td width="143"><center><% Response.write(ValidateDate(rs("DateSolved"))) %></center></td>
</tr>
<tr>
<td colspan=5 width="690"><hr color="#333333" size="1"></td>
</tr>
<% rs.movenext
loop

rs.Close
Conn.Close

Set rs = nothing
Set Conn = nothing
%></font></table>

So then I save this..and run the asp file in my browser and I get an error:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'ValidateDate'

/spi/bugs/results_page.asp, line 227

The type when it does have a date is datetime from SQL Server...
so I dont know exactly what is going wrong?? Cant the function still evaluate and check if the thing being passed in is null? Thats what my function does!!!

Maybe cause one of the fields pass in NULL? How do I cover from this...I thought the function ValidateDate(someDate) inside of it I check if IsNull...?? Is that ok ? Or do i have to check before entering this function, if so I see no point in creating this function.

Can anyone please tell me whats wrong with this?

Thanks,
Jon

jhermiz

3564 Posts

Posted - 2004-01-22 : 13:29:38
It cant be because null values, because I ensured that each row had a date in it...just to be safe. I still get the script error...
something about this function having invalid type:

<%
Function ValidateDate(someDate)
if IsNull(someDate) then
ValidateDate = 'N/A'
else
ValidateDate = FormatDateTime(someDate, 2)
end if
End Function
%>

Do functions in ASP need to state what the return type is going to be? Again, could it be that I have #included it incorrectly in my original post?

Jon
Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-01-22 : 13:40:59
Got it!

Include was wrong...
was supposed to be ../spi/scripts/thefile.asp

Also I change the function from 'N/A' to "N/A"

Thanks Jon
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2004-01-22 : 17:25:07
I've yet to see an example that shows a concrete difference in

<!-- #include file=

and

<!-- #include virtual=

Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-01-23 : 01:29:50
Sam,
If I recall one uses relative paths, the other doesn't.

It's been so long since I've done asp 3.0 I really don't know. ASP.net is soooooooooo much better than asp 3.0.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-01-23 : 08:09:34
Michael is correct...

"#include virtual=" means the page's path is specified relative to the web root whereas with "#include file=" the path is specified as relative to the current page's directory
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2004-01-23 : 08:48:11
For either..

../myfolder/myfile.asp

works the same. What's the dif?
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-01-23 : 08:58:42
My understanding is that since your example "../myfolder/myfile.asp" is referencing the path back to the root there is no difference but if you reference the path like "myfile.asp" only "#include file=" will resolve it...
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2004-01-23 : 09:35:52
OK. Stay with me here. This may sound stupid or like I have attidude. But rest assured, it's just stupid.

../

says go up one level. My tests show this is the same for file= and virtual=. Either go up one level from the location of the including file. All the time, every time. Relative pathing is what you get. No difference. Nada. Boopkas.

Similarly

file="myfolder/myfile.asp"
virtual="myfolder/myfile.asp"

work the same, dropping down to myfolder from the including file's folder.

There are two tests I haven't run, and the difference might be found there:

file="/myfile.asp"
virtual="/myfile.asp"

I believe either of these will return myfile from the root folder of the web. The leading / in the absence of .. means root of web. If so, then no difference in file or virtual there.

The other test would be:

file="D:/myfile.asp"
virtual="D:/myfile.asp"

I suspect this fails for virtual, and I have no idea if it works for file, but it would make sense that web based addressing wouldn't apply in this case because a drive letter is specified.

One last comment

file="http://mydomain.com/myfile.asp"
virtual="http://mydomain.com/myfile.asp"

both work the same.
Go to Top of Page

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-01-23 : 09:41:13
This is what I found on the subject:

http://www.w3schools.com/asp/asp_incfiles.asp
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2004-01-23 : 10:03:26
I've read w3schools and a few others on this subject. The examples used work for both file and virtual, skirting the issues of differences, and quoting the standard verse.

There is even a remark on W3 which points out similar behavior:

quote:
You can also use the file keyword with the syntax (..\) to include a file from a higher-level directory.


Meaning: file= behaves like virtual=, so file= may be a superset of virtual= ??

I haven't seen a practical example where the two includes behave differently. I'm sure it's there, but where I don't know.

I've been coding my paths using "/" (web syntax) not "\" (file system syntax). file and virtual may behave differently depending on the encoded syntax.

In the end, it may be that

file="\myfolder\myfile.asp" refers to the root of the current disk
file="/myfolder/myfile.asp" refers to the root of the current web

Go to Top of Page

jhermiz

3564 Posts

Posted - 2004-01-24 : 10:55:26
Guys...

Who cares

My problem was resolved...remember heheheh
Go to Top of Page
   

- Advertisement -