Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


visual basic script runtime error

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,2078
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> visual basic script runtime error
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 visual basic script runtime error - 2/16/2005 4:46:08 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
hi...
i have the following code when run gives me Microsoft VBScript runtime error '800a000d' Type mismatch. the error is on line 35; i have worked on it for one week now..but cannot figure out the error... any help will be much appreciated.... Line 35 is bold...

<% OPTION EXPLICIT %>
<!-- #INCLUDE FILE = 'connection.asp' -->
<!-- METADATA TYPE = "typelib"
FILE = "C:\Program Files\Common Files\System\ado\msado15.dll" -->

<HTML>
<HEAD>
</HEAD>
<BODY>

<%

Dim objRS, strFolder, objCommand, strtemp

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "mix", Conn, adOpenForwardOnly, adLockReadOnly, adCmdTable

strFolder = Request.Form("FOLDER")

Set objCommand = Server.CreateObject("ADODB.Command")

objCommand.ActiveConnection = Conn
objCommand.CommandText = "SELECT Folder, SeeAlso, FileSummary, subcontent FROM mix WHERE Folder LIKE '%" & strFolder & "%'"

objCommand.CommandType = adCmdText

Set objRS = objCommand.Execute

strtemp =objRS("Folder")

While Not objRS.EOF
Response.Write "Folder: " & objRS("Folder") & "<br>"
Response.Write "See Also: " & objRS("SeeAlso") & "<br>"
Response.Write "File Summary: " & objRS("FileSummary") & "<br>"
While objRS("Folder") = strtemp
Response.Write "Subcontents: " & objRS("subcontent") & "<br>"
objRS.MoveNext
If objRS.EOF = True Then
Set objRS = Nothing
Else

End If

Wend

Wend

objRS.CLOSE
Set objRS = Nothing

%>

</body>
</html>

_____________________________

zahid
 
 
Post #: 1
 
 Re: visual basic script runtime error - 2/16/2005 2:35:47 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
change

objRS("FileSummary")

to

objRS.Fields("FileSummary").Value

(in reply to zahid_a)
 
 
Post #: 2
 
 Re: visual basic script runtime error - 2/17/2005 4:12:30 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
hi...
well i realized that the error is not on the line that i had previously mentioned. its on the line after it(bold line in the code below). the database has a one to many relationship and i want to display it in the manner as it is in access. each folder contains many subcontents and thats why i am evaluating the

While objRS("Folder") = strtemp

is there another way i could check and print out subcontents while the folder name remains the same.

thanks...

<% OPTION EXPLICIT %>
<!-- #INCLUDE FILE = 'connection.asp' -->
<!-- METADATA TYPE = "typelib"
FILE = "C:\Program Files\Common Files\System\ado\msado15.dll" -->

<HTML>
<HEAD>
</HEAD>
<BODY>

<%

Dim objRS, strFolder, objCommand, strtemp

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "mix", Conn, adOpenForwardOnly, adLockReadOnly, adCmdTable

strFolder = Request.Form("FOLDER")

Set objCommand = Server.CreateObject("ADODB.Command")

objCommand.ActiveConnection = Conn
objCommand.CommandText = "SELECT Folder, SeeAlso, FileSummary, subcontent FROM mix WHERE Folder LIKE '%" & strFolder & "%'"

objCommand.CommandType = adCmdText

Set objRS = objCommand.Execute

strtemp =objRS("Folder")

While Not objRS.EOF
Response.Write "Folder: " & objRS("Folder") & "<br>"
Response.Write "See Also: " & objRS("SeeAlso") & "<br>"
Response.Write "File Summary: " & objRS("FileSummary") & "<br>"
While objRS("Folder") = strtemp
Response.Write "Subcontents: " & objRS("subcontent") & "<br>"
objRS.MoveNext
If objRS.EOF = True Then
Set objRS = Nothing
Else

End If

Wend

Wend

objRS.CLOSE
Set objRS = Nothing

%>

</body>
</html>

(in reply to zahid_a)
 
 
Post #: 3
 
 Re: visual basic script runtime error - 2/17/2005 7:40:03 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Without knowing the structure of of the database used, it's difficult to suggest anything. However, I think your code may be more complicated than it should. Also, I notice some logical errors in your doe: When "Set objRS = Nothing" is executed and exit the inner loop to go to "While Not objRS.EOF: again, I'm not sure what would happen since the recordset no longer exists.

Put the following line just above "While objRS("Folder") = strtemp" line
wscript.echo vartype(objRS("Folder")) & vbtab & vartype(strtemp)
to see if they are of the same type.

(in reply to zahid_a)
 
 
Post #: 4
 
 Re: visual basic script runtime error - 2/18/2005 4:44:37 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
hey...thanks for ur response guyz..i got the solution...instead of using what i was; i brought into use the SHAPE , APPEND & RELATE commands of data shaping....

thanks anyways...
chao

(in reply to zahid_a)
 
 
Post #: 5
 
 Re: visual basic script runtime error - 2/18/2005 10:13:42 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
heh, no idea what you are talking about here :) But I'm glad it works for you.

(in reply to zahid_a)
 
 
Post #: 6
 
 Re: visual basic script runtime error - 2/18/2005 4:20:12 PM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
Please post your final results so others may refer to it.
thanx.

(in reply to zahid_a)
 
 
Post #: 7
 
 Re: visual basic script runtime error - 2/18/2005 8:19:06 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Nooooo! I don't want to see it. <g> :D

It's Friday for God's sake :)

(in reply to zahid_a)
 
 
Post #: 8
 
 Re: visual basic script runtime error - 2/22/2005 6:10:32 AM   
  zahid_a

 

Posts: 14
Score: 0
Joined: 2/16/2005
From: Canada
Status: offline
This was my solution...

<% OPTION EXPLICIT %>

<!-- METADATA TYPE = "typelib"
FILE = "C:\Program Files\Common Files\System\ado\msado15.dll" -->

<HTML>
<HEAD>
<TITLE> TRYING THE SHAPE & APPEND </TITLE>
</HEAD>
<BODY>

<%

Dim strSQL, objRS, objChild, strConnection, strFolder, inti

inti = 0

strFolder = Request.Form("FOLDER")

strConnection = "Provider=MSDataShape;dsn=vertical;database=vertical final.mdb"

strSQL = "SHAPE { SELECT folder, FileSummary, SeeAlso FROM folder WHERE folder LIKE '%" & strFolder & "%' ORDER BY folder}" & _
"APPEND ({ SELECT folder, subcontent FROM subcontents WHERE folder LIKE '%" & strFolder & "%' ORDER BY folder} AS Test RELATE folder to folder)"

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, strConnection

Set objChild = Server.CreateObject("ADODB.Recordset")
objChild.Open "subcontents", strConnection, adOpenStatic, adLockReadOnly, adCmdTable

While Not objRS.EOF
Response.Write "<B>" & "Folder: " & "</B>" & objRS("folder") & "<BR>"
Response.Write "<B>" & "File Summary: " & "</b>" & objRS("FileSummary") & "<BR>"
Response.Write "<B>" & "See Also: " & "</b>" & objRS("SeeAlso") & "<BR>"
Response.Write "<B>" & "Subcontents: " & "</b>" & "<BR>"

Set objChild = objRS.Fields("Test").Value

While Not objChild.EOF
Response.Write " " & " " & " " & " " & objChild("subcontent")
Response.Write "<br>"
objChild.MoveNext

Wend
Response.Write "<br>"
Response.Write "<hr>"
inti = inti + 1
objRS.MoveNext
Wend


Response.Write "There are " & inti & " records on this page."

objRS.Close
Set objRS = Nothing

%>

</BODY>
</HTML>

(in reply to zahid_a)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> visual basic script runtime error Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts