Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch

Status
Not open for further replies.

Airpan

Technical User
Jun 14, 2005
172
US
I have a dbtest asp page that looks like so:
Code:
<% @Language="VBScript" %>
<html>
<body>
<% 

Dim oConn, Rec, sConn, sFilePath

   	Set oConn = Server.CreateObject("ADODB.Connection")
   	sFilePath = Server.MapPath("db/logins.mdb")
   	sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sFilePath & ";"
   	oConn.Open sConn
	Set Rec = oConn.Execute("SELECT * FROM inventory")

	Do While Not Rec.EOF

  Response.Write "Image<br>"
  Response.Write "LBound = " & LBound(Rec("PIC")) & "<br>"
  Response.Write "UBound = " & UBound(Rec("PIC")) & "<br>"
  Rec.MoveNext
Loop
Rec.Close
oConn.Close

%>
</body>
</html>
I am getting the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'LBound'
dbtest.asp, line 17


Line 17 is:
Code:
Response.Write "LBound = " & LBound(Rec("PIC")) & "<br>"

Is this happening because the images themselves are not in the database but rather only the URL to the image? I know that the LBound refers to arrays and the smallest subscript of that array, but that does not put it context for. This test page was supplied in a folder of examples for the photo upload I am building.

~E
 
what are you trying to do when you used LBound(Rec("PIC")) and UBound(Rec("PIC"))

-DNG
 
The variable named Rec is a recordset... object type.

LBound works on a variant type containing an array.

Maybe you could do LBound(Rec.GetRows()) ???
 
If this was supplied to you as part of the test code, throw it out. It is senseless and as others have pointed out, U/LBound only applies to arrays.

If you want to do soemthing with the PIC field, a better example in your loop would be something like:
Code:
Response.Write "<div style=""text-align: center; float: left;""><img src=""" & rec("PIC") & """/><br/>" & rec("PIC") & "</div>"

Which will output an image tag with the link in it and the text for the link. You may need to prepend some portion of the URL in the src attribute of the img tag to make the image show up correctly.

-T

Best MS KB Ever:
 
Thanks everyone for your help. Here is the long and short of it... as Tarwn pointed out, the page must be for an altogether different purpose than what I am looking for... I looked some more stuff up online and have yet to discover what I would need that page for.

At any rate, I would like to say that I am a bit of a loss for this software that my company purchased, as it is for photo upload and for all intensive purposes, it will do what we need it to do. However, their documentation really kind of stinks to be honest, and I am completely clueless how to go about implementing it. Not that I expect anyone here to be able to remedy that, but at least I can vent here.

At any rate, I guess I will have to continue to stumble through their "manual" and see what I can come up with. Thanks again.

~E
 
Just thought I would say that I finally got this figured out in terms of their "help" files. The page I was trying to test is for using file type arrays for photographs (png.psd, etc etc)- at least that is what the documentation said, so I really don't need that page right now... may need it in the future but not right now.

~E
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top